
<!DOCTYPE html>

<html>
  
<!-- Mirrored from docs.sympy.org/latest/modules/combinatorics/perm_groups.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 15 Jan 2022 03:26:04 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

    <title>Permutation Groups &#8212; SymPy 1.9 documentation</title>
    <link rel="stylesheet" type="text/css" href="../../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/default.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/graphviz.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/plot_directive.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-core.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-autocomplete.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-sphinx.css" />
    
    <script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
    <script src="../../_static/jquery.js"></script>
    <script src="../../_static/underscore.js"></script>
    <script src="../../_static/doctools.js"></script>
    <script src="../../../../live.sympy.org/static/utilities.js"></script>
    <script src="../../../../live.sympy.org/static/external/classy.js"></script>
    <script src="../../../../live.sympy.org/static/live-core.js"></script>
    <script src="../../../../live.sympy.org/static/live-autocomplete.js"></script>
    <script src="../../../../live.sympy.org/static/live-sphinx.js"></script>
    <script async="async" src="../../../../cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest8331.js?config=TeX-AMS_HTML-full"></script>
    <script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"inlineMath": [["\\(", "\\)"]], "displayMath": [["\\[", "\\]"]]}})</script>
    
    <link rel="shortcut icon" href="../../_static/sympy-notailtext-favicon.ico"/>
    <link href="perm_groups.html" rel="canonical" />
    
    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" />
    <link rel="next" title="Polyhedron" href="polyhedron.html" />
    <link rel="prev" title="Permutations" href="permutations.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="polyhedron.html" title="Polyhedron"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="permutations.html" title="Permutations"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">SymPy 1.9 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../index.html" >SymPy Modules Reference</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="index.html" accesskey="U">Combinatorics</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="#">Permutation Groups</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <section id="module-sympy.combinatorics.perm_groups">
<span id="permutation-groups"></span><span id="combinatorics-perm-groups"></span><h1>Permutation Groups<a class="headerlink" href="#module-sympy.combinatorics.perm_groups" title="Permalink to this headline">¶</a></h1>
<dl class="py class">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.combinatorics.perm_groups.</span></span><span class="sig-name descname"><span class="pre">PermutationGroup</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dups</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L24-L4988"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup" title="Permalink to this definition">¶</a></dt>
<dd><p>The class defining a Permutation group.</p>
<p class="rubric">Explanation</p>
<p>PermutationGroup([p1, p2, …, pn]) returns the permutation group
generated by the list of permutations. This group can be supplied
to Polyhedron if one desires to decorate the elements to which the
indices of the permutation refer.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">Permutation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.polyhedron</span> <span class="kn">import</span> <span class="n">Polyhedron</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.perm_groups</span> <span class="kn">import</span> <span class="n">PermutationGroup</span>
</pre></div>
</div>
<p>The permutations corresponding to motion of the front, right and
bottom face of a 2x2 Rubik’s cube are defined:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">F</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">19</span><span class="p">,</span> <span class="mi">21</span><span class="p">,</span> <span class="mi">8</span><span class="p">)(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">17</span><span class="p">,</span> <span class="mi">20</span><span class="p">,</span> <span class="mi">10</span><span class="p">)(</span><span class="mi">4</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">21</span><span class="p">,</span> <span class="mi">14</span><span class="p">)(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">23</span><span class="p">,</span> <span class="mi">12</span><span class="p">)(</span><span class="mi">8</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="mi">11</span><span class="p">,</span> <span class="mi">9</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">D</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">(</span><span class="mi">6</span><span class="p">,</span> <span class="mi">18</span><span class="p">,</span> <span class="mi">14</span><span class="p">,</span> <span class="mi">10</span><span class="p">)(</span><span class="mi">7</span><span class="p">,</span> <span class="mi">19</span><span class="p">,</span> <span class="mi">15</span><span class="p">,</span> <span class="mi">11</span><span class="p">)(</span><span class="mi">20</span><span class="p">,</span> <span class="mi">22</span><span class="p">,</span> <span class="mi">23</span><span class="p">,</span> <span class="mi">21</span><span class="p">)</span>
</pre></div>
</div>
<p>These are passed as permutations to PermutationGroup:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">(</span><span class="n">F</span><span class="p">,</span> <span class="n">R</span><span class="p">,</span> <span class="n">D</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">order</span><span class="p">()</span>
<span class="go">3674160</span>
</pre></div>
</div>
<p>The group can be supplied to a Polyhedron in order to track the
objects being moved. An example involving the 2x2 Rubik’s cube is
given there, but here is a simple demonstration:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">P</span> <span class="o">=</span> <span class="n">Polyhedron</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="s1">&#39;ABC&#39;</span><span class="p">),</span> <span class="n">pgroup</span><span class="o">=</span><span class="n">G</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">P</span><span class="o">.</span><span class="n">corners</span>
<span class="go">(A, B, C)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">P</span><span class="o">.</span><span class="n">rotate</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="c1"># apply permutation 0</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">P</span><span class="o">.</span><span class="n">corners</span>
<span class="go">(A, C, B)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">P</span><span class="o">.</span><span class="n">reset</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">P</span><span class="o">.</span><span class="n">corners</span>
<span class="go">(A, B, C)</span>
</pre></div>
</div>
<p>Or one can make a permutation as a product of selected permutations
and apply them to an iterable directly:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">P10</span> <span class="o">=</span> <span class="n">G</span><span class="o">.</span><span class="n">make_perm</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">P10</span><span class="p">(</span><span class="s1">&#39;ABC&#39;</span><span class="p">)</span>
<span class="go">[&#39;C&#39;, &#39;A&#39;, &#39;B&#39;]</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="polyhedron.html#sympy.combinatorics.polyhedron.Polyhedron" title="sympy.combinatorics.polyhedron.Polyhedron"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.combinatorics.polyhedron.Polyhedron</span></code></a>, <a class="reference internal" href="permutations.html#sympy.combinatorics.permutations.Permutation" title="sympy.combinatorics.permutations.Permutation"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.combinatorics.permutations.Permutation</span></code></a></p>
</div>
<p class="rubric">References</p>
<dl class="citation">
<dt class="label" id="r46"><span class="brackets"><a class="fn-backref" href="#id6">R46</a></span></dt>
<dd><p>Holt, D., Eick, B., O’Brien, E.
“Handbook of Computational Group Theory”</p>
</dd>
<dt class="label" id="r47"><span class="brackets"><a class="fn-backref" href="#id7">R47</a></span></dt>
<dd><p>Seress, A.
“Permutation Group Algorithms”</p>
</dd>
<dt class="label" id="r48"><span class="brackets"><a class="fn-backref" href="#id8">R48</a></span></dt>
<dd><p><a class="reference external" href="https://en.wikipedia.org/wiki/Schreier_vector">https://en.wikipedia.org/wiki/Schreier_vector</a></p>
</dd>
<dt class="label" id="r49"><span class="brackets"><a class="fn-backref" href="#id9">R49</a></span></dt>
<dd><p><a class="reference external" href="https://en.wikipedia.org/wiki/Nielsen_transformation#Product_replacement_algorithm">https://en.wikipedia.org/wiki/Nielsen_transformation#Product_replacement_algorithm</a></p>
</dd>
<dt class="label" id="r50"><span class="brackets"><a class="fn-backref" href="#id10">R50</a></span></dt>
<dd><p>Frank Celler, Charles R.Leedham-Green, Scott H.Murray,
Alice C.Niemeyer, and E.A.O’Brien. “Generating Random
Elements of a Finite Group”</p>
</dd>
<dt class="label" id="r51"><span class="brackets"><a class="fn-backref" href="#id11">R51</a></span></dt>
<dd><p><a class="reference external" href="https://en.wikipedia.org/wiki/Block_(permutation_group_theory)">https://en.wikipedia.org/wiki/Block_%28permutation_group_theory%29</a></p>
</dd>
<dt class="label" id="r52"><span class="brackets"><a class="fn-backref" href="#id12">R52</a></span></dt>
<dd><p><a class="reference external" href="http://www.algorithmist.com/index.php/Union_Find">http://www.algorithmist.com/index.php/Union_Find</a></p>
</dd>
<dt class="label" id="r53"><span class="brackets"><a class="fn-backref" href="#id13">R53</a></span></dt>
<dd><p><a class="reference external" href="https://en.wikipedia.org/wiki/Multiply_transitive_group#Multiply_transitive_groups">https://en.wikipedia.org/wiki/Multiply_transitive_group#Multiply_transitive_groups</a></p>
</dd>
<dt class="label" id="r54"><span class="brackets"><a class="fn-backref" href="#id14">R54</a></span></dt>
<dd><p><a class="reference external" href="https://en.wikipedia.org/wiki/Center_(group_theory)">https://en.wikipedia.org/wiki/Center_%28group_theory%29</a></p>
</dd>
</dl>
<dl class="footnote brackets">
<dt class="label" id="id1"><span class="brackets"><a class="fn-backref" href="#id15">10</a></span></dt>
<dd><p><a class="reference external" href="https://en.wikipedia.org/wiki/Centralizer_and_normalizer">https://en.wikipedia.org/wiki/Centralizer_and_normalizer</a></p>
</dd>
<dt class="label" id="id2"><span class="brackets"><a class="fn-backref" href="#id16">11</a></span></dt>
<dd><p><a class="reference external" href="http://groupprops.subwiki.org/wiki/Derived_subgroup">http://groupprops.subwiki.org/wiki/Derived_subgroup</a></p>
</dd>
<dt class="label" id="id3"><span class="brackets"><a class="fn-backref" href="#id17">12</a></span></dt>
<dd><p><a class="reference external" href="https://en.wikipedia.org/wiki/Nilpotent_group">https://en.wikipedia.org/wiki/Nilpotent_group</a></p>
</dd>
<dt class="label" id="id4"><span class="brackets"><a class="fn-backref" href="#id18">13</a></span></dt>
<dd><p><a class="reference external" href="http://www.math.colostate.edu/~hulpke/CGT/cgtnotes.pdf">http://www.math.colostate.edu/~hulpke/CGT/cgtnotes.pdf</a></p>
</dd>
<dt class="label" id="id5"><span class="brackets"><a class="fn-backref" href="#id19">14</a></span></dt>
<dd><p><a class="reference external" href="https://www.gap-system.org/Manuals/doc/ref/manual.pdf">https://www.gap-system.org/Manuals/doc/ref/manual.pdf</a></p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.__contains__">
<span class="sig-name descname"><span class="pre">__contains__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">i</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L183-L198"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.__contains__" title="Permalink to this definition">¶</a></dt>
<dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if <em>i</em> is contained in PermutationGroup.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">Permutation</span><span class="p">,</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Permutation</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span> <span class="ow">in</span> <span class="n">PermutationGroup</span><span class="p">(</span><span class="n">p</span><span class="p">)</span>
<span class="go">True</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.__eq__">
<span class="sig-name descname"><span class="pre">__eq__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">other</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L203-L241"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.__eq__" title="Permalink to this definition">¶</a></dt>
<dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if PermutationGroup generated by elements in the
group are same i.e they represent the same PermutationGroup.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">Permutation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.perm_groups</span> <span class="kn">import</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">p</span><span class="p">,</span> <span class="n">p</span><span class="o">**</span><span class="mi">2</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">H</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">p</span><span class="o">**</span><span class="mi">2</span><span class="p">,</span> <span class="n">p</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">generators</span> <span class="o">==</span> <span class="n">H</span><span class="o">.</span><span class="n">generators</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">==</span> <span class="n">H</span>
<span class="go">True</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.__mul__">
<span class="sig-name descname"><span class="pre">__mul__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">other</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L246-L287"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.__mul__" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the direct product of two permutation groups as a permutation
group.</p>
<p class="rubric">Explanation</p>
<p>This implementation realizes the direct product by shifting the index
set for the generators of the second group: so if we have <code class="docutils literal notranslate"><span class="pre">G</span></code> acting
on <code class="docutils literal notranslate"><span class="pre">n1</span></code> points and <code class="docutils literal notranslate"><span class="pre">H</span></code> acting on <code class="docutils literal notranslate"><span class="pre">n2</span></code> points, <code class="docutils literal notranslate"><span class="pre">G*H</span></code> acts on
<code class="docutils literal notranslate"><span class="pre">n1</span> <span class="pre">+</span> <span class="pre">n2</span></code> points.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="n">CyclicGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">CyclicGroup</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">H</span> <span class="o">=</span> <span class="n">G</span><span class="o">*</span><span class="n">G</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">H</span>
<span class="go">PermutationGroup([</span>
<span class="go">    (9)(0 1 2 3 4),</span>
<span class="go">    (5 6 7 8 9)])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">H</span><span class="o">.</span><span class="n">order</span><span class="p">()</span>
<span class="go">25</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.__new__">
<em class="property"><span class="pre">static</span> </em><span class="sig-name descname"><span class="pre">__new__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cls</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dups</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L123-L178"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.__new__" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.__weakref__">
<span class="sig-name descname"><span class="pre">__weakref__</span></span><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.__weakref__" title="Permalink to this definition">¶</a></dt>
<dd><p>list of weak references to the object (if defined)</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup._coset_representative">
<span class="sig-name descname"><span class="pre">_coset_representative</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">g</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">H</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L861-L886"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup._coset_representative" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the representative of Hg from the transversal that
would be computed by <code class="docutils literal notranslate"><span class="pre">self.coset_transversal(H)</span></code>.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup._distinct_primes_lemma">
<em class="property"><span class="pre">classmethod</span> </em><span class="sig-name descname"><span class="pre">_distinct_primes_lemma</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">primes</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L3162-L3172"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup._distinct_primes_lemma" title="Permalink to this definition">¶</a></dt>
<dd><p>Subroutine to test if there is only one cyclic group for the
order.</p>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup._elements">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">_elements</span></span><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup._elements" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns all the elements of the permutation group as a list</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">Permutation</span><span class="p">,</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">(</span><span class="n">Permutation</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">),</span> <span class="n">Permutation</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">_elements</span>
<span class="go">[(3), (3)(1 2), (1 3), (2 3), (1 2 3), (1 3 2)]</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup._eval_is_alt_sym_monte_carlo">
<span class="sig-name descname"><span class="pre">_eval_is_alt_sym_monte_carlo</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">eps</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.05</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">perms</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L1956-L1992"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup._eval_is_alt_sym_monte_carlo" title="Permalink to this definition">¶</a></dt>
<dd><p>A test using monte-carlo algorithm.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>eps</strong> : float, optional</p>
<blockquote>
<div><p>The criterion for the incorrect <code class="docutils literal notranslate"><span class="pre">False</span></code> return.</p>
</div></blockquote>
<p><strong>perms</strong> : list[Permutation], optional</p>
<blockquote>
<div><p>If explicitly given, it tests over the given candidats
for testing.</p>
<p>If <code class="docutils literal notranslate"><span class="pre">None</span></code>, it randomly computes <code class="docutils literal notranslate"><span class="pre">N_eps</span></code> and chooses
<code class="docutils literal notranslate"><span class="pre">N_eps</span></code> sample of the permutation from the group.</p>
</div></blockquote>
</dd>
</dl>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="util.html#sympy.combinatorics.util._check_cycles_alt_sym" title="sympy.combinatorics.util._check_cycles_alt_sym"><code class="xref py py-obj docutils literal notranslate"><span class="pre">_check_cycles_alt_sym</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup._eval_is_alt_sym_naive">
<span class="sig-name descname"><span class="pre">_eval_is_alt_sym_naive</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">only_sym</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">only_alt</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L1927-L1954"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup._eval_is_alt_sym_naive" title="Permalink to this definition">¶</a></dt>
<dd><p>A naive test using the group order.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup._p_elements_group">
<span class="sig-name descname"><span class="pre">_p_elements_group</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L4247-L4283"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup._p_elements_group" title="Permalink to this definition">¶</a></dt>
<dd><p>For an abelian p-group G return the subgroup consisting of
all elements of order p (and the identity)</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup._random_pr_init">
<span class="sig-name descname"><span class="pre">_random_pr_init</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">r</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">_random_prec_n</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L289-L347"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup._random_pr_init" title="Permalink to this definition">¶</a></dt>
<dd><p>Initialize random generators for the product replacement algorithm.</p>
<p class="rubric">Explanation</p>
<p>The implementation uses a modification of the original product
replacement algorithm due to Leedham-Green, as described in [1],
pp. 69-71; also, see [2], pp. 27-29 for a detailed theoretical
analysis of the original product replacement algorithm, and [4].</p>
<p>The product replacement algorithm is used for producing random,
uniformly distributed elements of a group <span class="math notranslate nohighlight">\(G\)</span> with a set of generators
<span class="math notranslate nohighlight">\(S\)</span>. For the initialization <code class="docutils literal notranslate"><span class="pre">_random_pr_init</span></code>, a list <code class="docutils literal notranslate"><span class="pre">R</span></code> of
<span class="math notranslate nohighlight">\(\max\{r, |S|\}\)</span> group generators is created as the attribute
<code class="docutils literal notranslate"><span class="pre">G._random_gens</span></code>, repeating elements of <span class="math notranslate nohighlight">\(S\)</span> if necessary, and the
identity element of <span class="math notranslate nohighlight">\(G\)</span> is appended to <code class="docutils literal notranslate"><span class="pre">R</span></code> - we shall refer to this
last element as the accumulator. Then the function <code class="docutils literal notranslate"><span class="pre">random_pr()</span></code>
is called <code class="docutils literal notranslate"><span class="pre">n</span></code> times, randomizing the list <code class="docutils literal notranslate"><span class="pre">R</span></code> while preserving
the generation of <span class="math notranslate nohighlight">\(G\)</span> by <code class="docutils literal notranslate"><span class="pre">R</span></code>. The function <code class="docutils literal notranslate"><span class="pre">random_pr()</span></code> itself
takes two random elements <code class="docutils literal notranslate"><span class="pre">g,</span> <span class="pre">h</span></code> among all elements of <code class="docutils literal notranslate"><span class="pre">R</span></code> but
the accumulator and replaces <code class="docutils literal notranslate"><span class="pre">g</span></code> with a randomly chosen element
from <span class="math notranslate nohighlight">\(\{gh, g(~h), hg, (~h)g\}\)</span>. Then the accumulator is multiplied
by whatever <code class="docutils literal notranslate"><span class="pre">g</span></code> was replaced by. The new value of the accumulator is
then returned by <code class="docutils literal notranslate"><span class="pre">random_pr()</span></code>.</p>
<p>The elements returned will eventually (for <code class="docutils literal notranslate"><span class="pre">n</span></code> large enough) become
uniformly distributed across <span class="math notranslate nohighlight">\(G\)</span> ([5]). For practical purposes however,
the values <code class="docutils literal notranslate"><span class="pre">n</span> <span class="pre">=</span> <span class="pre">50,</span> <span class="pre">r</span> <span class="pre">=</span> <span class="pre">11</span></code> are suggested in [1].</p>
<p class="rubric">Notes</p>
<p>THIS FUNCTION HAS SIDE EFFECTS: it changes the attribute
self._random_gens</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.random_pr" title="sympy.combinatorics.perm_groups.PermutationGroup.random_pr"><code class="xref py py-obj docutils literal notranslate"><span class="pre">random_pr</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup._sylow_alt_sym">
<span class="sig-name descname"><span class="pre">_sylow_alt_sym</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L4285-L4389"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup._sylow_alt_sym" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a p-Sylow subgroup of a symmetric or an
alternating group.</p>
<p class="rubric">Explanation</p>
<p>The algorithm for this is hinted at in [1], Chapter 4,
Exercise 4.</p>
<p>For Sym(n) with n = p^i, the idea is as follows. Partition
the interval [0..n-1] into p equal parts, each of length p^(i-1):
[0..p^(i-1)-1], [p^(i-1)..2*p^(i-1)-1]…[(p-1)*p^(i-1)..p^i-1].
Find a p-Sylow subgroup of Sym(p^(i-1)) (treated as a subgroup
of <code class="docutils literal notranslate"><span class="pre">self</span></code>) acting on each of the parts. Call the subgroups
P_1, P_2…P_p. The generators for the subgroups P_2…P_p
can be obtained from those of P_1 by applying a “shifting”
permutation to them, that is, a permutation mapping [0..p^(i-1)-1]
to the second part (the other parts are obtained by using the shift
multiple times). The union of this permutation and the generators
of P_1 is a p-Sylow subgroup of <code class="docutils literal notranslate"><span class="pre">self</span></code>.</p>
<p>For n not equal to a power of p, partition
[0..n-1] in accordance with how n would be written in base p.
E.g. for p=2 and n=11, 11 = 2^3 + 2^2 + 1 so the partition
is [[0..7], [8..9], {10}]. To generate a p-Sylow subgroup,
take the union of the generators for each of the parts.
For the above example, {(0 1), (0 2)(1 3), (0 4), (1 5)(2 7)}
from the first part, {(8 9)} from the second part and
nothing from the third. This gives 4 generators in total, and
the subgroup they generate is p-Sylow.</p>
<p>Alternating groups are treated the same except when p=2. In this
case, (0 1)(s s+1) should be added for an appropriate s (the start
of a part) for each part in the partitions.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.sylow_subgroup" title="sympy.combinatorics.perm_groups.PermutationGroup.sylow_subgroup"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sylow_subgroup</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.is_alt_sym" title="sympy.combinatorics.perm_groups.PermutationGroup.is_alt_sym"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_alt_sym</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup._union_find_merge">
<span class="sig-name descname"><span class="pre">_union_find_merge</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">first</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">second</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ranks</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">parents</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">not_rep</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L349-L396"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup._union_find_merge" title="Permalink to this definition">¶</a></dt>
<dd><p>Merges two classes in a union-find data structure.</p>
<p class="rubric">Explanation</p>
<p>Used in the implementation of Atkinson’s algorithm as suggested in [1],
pp. 83-87. The class merging process uses union by rank as an
optimization. ([7])</p>
<p class="rubric">Notes</p>
<p>THIS FUNCTION HAS SIDE EFFECTS: the list of class representatives,
<code class="docutils literal notranslate"><span class="pre">parents</span></code>, the list of class sizes, <code class="docutils literal notranslate"><span class="pre">ranks</span></code>, and the list of
elements that are not representatives, <code class="docutils literal notranslate"><span class="pre">not_rep</span></code>, are changed due to
class merging.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.minimal_block" title="sympy.combinatorics.perm_groups.PermutationGroup.minimal_block"><code class="xref py py-obj docutils literal notranslate"><span class="pre">minimal_block</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup._union_find_rep" title="sympy.combinatorics.perm_groups.PermutationGroup._union_find_rep"><code class="xref py py-obj docutils literal notranslate"><span class="pre">_union_find_rep</span></code></a></p>
</div>
<p class="rubric">References</p>
<dl class="citation">
<dt class="label" id="r55"><span class="brackets"><a class="fn-backref" href="#id20">R55</a></span></dt>
<dd><p>Holt, D., Eick, B., O’Brien, E.
“Handbook of computational group theory”</p>
</dd>
<dt class="label" id="r61"><span class="brackets"><a class="fn-backref" href="#id21">R61</a></span></dt>
<dd><p><a class="reference external" href="http://www.algorithmist.com/index.php/Union_Find">http://www.algorithmist.com/index.php/Union_Find</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup._union_find_rep">
<span class="sig-name descname"><span class="pre">_union_find_rep</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">num</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">parents</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L398-L439"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup._union_find_rep" title="Permalink to this definition">¶</a></dt>
<dd><p>Find representative of a class in a union-find data structure.</p>
<p class="rubric">Explanation</p>
<p>Used in the implementation of Atkinson’s algorithm as suggested in [1],
pp. 83-87. After the representative of the class to which <code class="docutils literal notranslate"><span class="pre">num</span></code>
belongs is found, path compression is performed as an optimization
([7]).</p>
<p class="rubric">Notes</p>
<p>THIS FUNCTION HAS SIDE EFFECTS: the list of class representatives,
<code class="docutils literal notranslate"><span class="pre">parents</span></code>, is altered due to path compression.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.minimal_block" title="sympy.combinatorics.perm_groups.PermutationGroup.minimal_block"><code class="xref py py-obj docutils literal notranslate"><span class="pre">minimal_block</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup._union_find_merge" title="sympy.combinatorics.perm_groups.PermutationGroup._union_find_merge"><code class="xref py py-obj docutils literal notranslate"><span class="pre">_union_find_merge</span></code></a></p>
</div>
<p class="rubric">References</p>
<dl class="citation">
<dt class="label" id="r57"><span class="brackets"><a class="fn-backref" href="#id22">R57</a></span></dt>
<dd><p>Holt, D., Eick, B., O’Brien, E.
“Handbook of computational group theory”</p>
</dd>
<dt class="label" id="r63"><span class="brackets"><a class="fn-backref" href="#id23">R63</a></span></dt>
<dd><p><a class="reference external" href="http://www.algorithmist.com/index.php/Union_Find">http://www.algorithmist.com/index.php/Union_Find</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup._verify">
<span class="sig-name descname"><span class="pre">_verify</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">K</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">phi</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">z</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">alpha</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L4589-L4707"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup._verify" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a list of relators <code class="docutils literal notranslate"><span class="pre">rels</span></code> in generators <code class="docutils literal notranslate"><span class="pre">gens`_h`</span> <span class="pre">that</span>
<span class="pre">are</span> <span class="pre">mapped</span> <span class="pre">to</span> <span class="pre">``H.generators</span></code> by <code class="docutils literal notranslate"><span class="pre">phi</span></code> so that given a finite
presentation &lt;gens_k | rels_k&gt; of <code class="docutils literal notranslate"><span class="pre">K</span></code> on a subset of <code class="docutils literal notranslate"><span class="pre">gens_h</span></code>
&lt;gens_h | rels_k + rels&gt; is a finite presentation of <code class="docutils literal notranslate"><span class="pre">H</span></code>.</p>
<p class="rubric">Explanation</p>
<p><code class="docutils literal notranslate"><span class="pre">H</span></code> should be generated by the union of <code class="docutils literal notranslate"><span class="pre">K.generators</span></code> and <code class="docutils literal notranslate"><span class="pre">z</span></code>
(a single generator), and <code class="docutils literal notranslate"><span class="pre">H.stabilizer(alpha)</span> <span class="pre">==</span> <span class="pre">K</span></code>; <code class="docutils literal notranslate"><span class="pre">phi</span></code> is a
canonical injection from a free group into a permutation group
containing <code class="docutils literal notranslate"><span class="pre">H</span></code>.</p>
<p>The algorithm is described in [1], Chapter 6.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.perm_groups</span> <span class="kn">import</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">Permutation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.homomorphisms</span> <span class="kn">import</span> <span class="n">homomorphism</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.free_groups</span> <span class="kn">import</span> <span class="n">free_group</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.fp_groups</span> <span class="kn">import</span> <span class="n">FpGroup</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">H</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">(</span><span class="n">Permutation</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="n">Permutation</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">5</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">K</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">(</span><span class="n">Permutation</span><span class="p">(</span><span class="mi">5</span><span class="p">)(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">F</span> <span class="o">=</span> <span class="n">free_group</span><span class="p">(</span><span class="s2">&quot;x_0 x_1&quot;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">gens</span> <span class="o">=</span> <span class="n">F</span><span class="o">.</span><span class="n">generators</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">phi</span> <span class="o">=</span> <span class="n">homomorphism</span><span class="p">(</span><span class="n">F</span><span class="p">,</span> <span class="n">H</span><span class="p">,</span> <span class="n">F</span><span class="o">.</span><span class="n">generators</span><span class="p">,</span> <span class="n">H</span><span class="o">.</span><span class="n">generators</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rels_k</span> <span class="o">=</span> <span class="p">[</span><span class="n">gens</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">**</span><span class="mi">2</span><span class="p">]</span> <span class="c1"># relators for presentation of K</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">z</span><span class="o">=</span> <span class="n">Permutation</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">check</span><span class="p">,</span> <span class="n">rels_h</span> <span class="o">=</span> <span class="n">H</span><span class="o">.</span><span class="n">_verify</span><span class="p">(</span><span class="n">K</span><span class="p">,</span> <span class="n">phi</span><span class="p">,</span> <span class="n">z</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">check</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rels</span> <span class="o">=</span> <span class="n">rels_k</span> <span class="o">+</span> <span class="n">rels_h</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">FpGroup</span><span class="p">(</span><span class="n">F</span><span class="p">,</span> <span class="n">rels</span><span class="p">)</span> <span class="c1"># presentation of H</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">order</span><span class="p">()</span> <span class="o">==</span> <span class="n">H</span><span class="o">.</span><span class="n">order</span><span class="p">()</span>
<span class="go">True</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.strong_presentation" title="sympy.combinatorics.perm_groups.PermutationGroup.strong_presentation"><code class="xref py py-obj docutils literal notranslate"><span class="pre">strong_presentation</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.presentation" title="sympy.combinatorics.perm_groups.PermutationGroup.presentation"><code class="xref py py-obj docutils literal notranslate"><span class="pre">presentation</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.stabilizer" title="sympy.combinatorics.perm_groups.PermutationGroup.stabilizer"><code class="xref py py-obj docutils literal notranslate"><span class="pre">stabilizer</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.abelian_invariants">
<span class="sig-name descname"><span class="pre">abelian_invariants</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L1827-L1900"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.abelian_invariants" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the abelian invariants for the given group.
Let <code class="docutils literal notranslate"><span class="pre">G</span></code> be a nontrivial finite abelian group. Then G is isomorphic to
the direct product of finitely many nontrivial cyclic groups of
prime-power order.</p>
<p class="rubric">Explanation</p>
<p>The prime-powers that occur as the orders of the factors are uniquely
determined by G. More precisely, the primes that occur in the orders of the
factors in any such decomposition of <code class="docutils literal notranslate"><span class="pre">G</span></code> are exactly the primes that divide
<code class="docutils literal notranslate"><span class="pre">|G|</span></code> and for any such prime <code class="docutils literal notranslate"><span class="pre">p</span></code>, if the orders of the factors that are
p-groups in one such decomposition of <code class="docutils literal notranslate"><span class="pre">G</span></code> are <code class="docutils literal notranslate"><span class="pre">p^{t_1}</span> <span class="pre">&gt;=</span> <span class="pre">p^{t_2}</span> <span class="pre">&gt;=</span> <span class="pre">...</span> <span class="pre">p^{t_r}</span></code>,
then the orders of the factors that are p-groups in any such decomposition of <code class="docutils literal notranslate"><span class="pre">G</span></code>
are <code class="docutils literal notranslate"><span class="pre">p^{t_1}</span> <span class="pre">&gt;=</span> <span class="pre">p^{t_2}</span> <span class="pre">&gt;=</span> <span class="pre">...</span> <span class="pre">p^{t_r}</span></code>.</p>
<p>The uniquely determined integers <code class="docutils literal notranslate"><span class="pre">p^{t_1}</span> <span class="pre">&gt;=</span> <span class="pre">p^{t_2}</span> <span class="pre">&gt;=</span> <span class="pre">...</span> <span class="pre">p^{t_r}</span></code>, taken
for all primes that divide <code class="docutils literal notranslate"><span class="pre">|G|</span></code> are called the invariants of the nontrivial
group <code class="docutils literal notranslate"><span class="pre">G</span></code> as suggested in ([14], p. 542).</p>
<p class="rubric">Notes</p>
<p>We adopt the convention that the invariants of a trivial group are [].</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">Permutation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.perm_groups</span> <span class="kn">import</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">abelian_invariants</span><span class="p">()</span>
<span class="go">[2]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="n">CyclicGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">CyclicGroup</span><span class="p">(</span><span class="mi">7</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">abelian_invariants</span><span class="p">()</span>
<span class="go">[7]</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.base">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">base</span></span><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.base" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a base from the Schreier-Sims algorithm.</p>
<p class="rubric">Explanation</p>
<p>For a permutation group <span class="math notranslate nohighlight">\(G\)</span>, a base is a sequence of points
<span class="math notranslate nohighlight">\(B = (b_1, b_2, ..., b_k)\)</span> such that no element of <span class="math notranslate nohighlight">\(G\)</span> apart
from the identity fixes all the points in <span class="math notranslate nohighlight">\(B\)</span>. The concepts of
a base and strong generating set and their applications are
discussed in depth in [1], pp. 87-89 and [2], pp. 55-57.</p>
<p>An alternative way to think of <span class="math notranslate nohighlight">\(B\)</span> is that it gives the
indices of the stabilizer cosets that contain more than the
identity permutation.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">Permutation</span><span class="p">,</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">Permutation</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">)(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">4</span><span class="p">)])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">base</span>
<span class="go">[0, 2]</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.strong_gens" title="sympy.combinatorics.perm_groups.PermutationGroup.strong_gens"><code class="xref py py-obj docutils literal notranslate"><span class="pre">strong_gens</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.basic_transversals" title="sympy.combinatorics.perm_groups.PermutationGroup.basic_transversals"><code class="xref py py-obj docutils literal notranslate"><span class="pre">basic_transversals</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.basic_orbits" title="sympy.combinatorics.perm_groups.PermutationGroup.basic_orbits"><code class="xref py py-obj docutils literal notranslate"><span class="pre">basic_orbits</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.basic_stabilizers" title="sympy.combinatorics.perm_groups.PermutationGroup.basic_stabilizers"><code class="xref py py-obj docutils literal notranslate"><span class="pre">basic_stabilizers</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.baseswap">
<span class="sig-name descname"><span class="pre">baseswap</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">base</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">strong_gens</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pos</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">randomized</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">transversals</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">basic_orbits</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">strong_gens_distr</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L476-L608"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.baseswap" title="Permalink to this definition">¶</a></dt>
<dd><p>Swap two consecutive base points in base and strong generating set.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>base, strong_gens</strong></p>
<blockquote>
<div><p>The base and strong generating set.</p>
</div></blockquote>
<p><strong>pos</strong></p>
<blockquote>
<div><p>The position at which swapping is performed.</p>
</div></blockquote>
<p><strong>randomized</strong></p>
<blockquote>
<div><p>A switch between randomized and deterministic version.</p>
</div></blockquote>
<p><strong>transversals</strong></p>
<blockquote>
<div><p>The transversals for the basic orbits, if known.</p>
</div></blockquote>
<p><strong>basic_orbits</strong></p>
<blockquote>
<div><p>The basic orbits, if known.</p>
</div></blockquote>
<p><strong>strong_gens_distr</strong></p>
<blockquote>
<div><p>The strong generators distributed by basic stabilizers, if known.</p>
</div></blockquote>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>(base, strong_gens)</p>
<blockquote>
<div><p><code class="docutils literal notranslate"><span class="pre">base</span></code> is the new base, and <code class="docutils literal notranslate"><span class="pre">strong_gens</span></code> is a generating set
relative to it.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Explanation</p>
<p>If a base for a group <span class="math notranslate nohighlight">\(G\)</span> is given by <span class="math notranslate nohighlight">\((b_1, b_2, ..., b_k)\)</span>, this
function returns a base <span class="math notranslate nohighlight">\((b_1, b_2, ..., b_{i+1}, b_i, ..., b_k)\)</span>,
where <span class="math notranslate nohighlight">\(i\)</span> is given by <code class="docutils literal notranslate"><span class="pre">pos</span></code>, and a strong generating set relative
to that base. The original base and strong generating set are not
modified.</p>
<p>The randomized version (default) is of Las Vegas type.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="n">SymmetricGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.testutil</span> <span class="kn">import</span> <span class="n">_verify_bsgs</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.perm_groups</span> <span class="kn">import</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S</span> <span class="o">=</span> <span class="n">SymmetricGroup</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S</span><span class="o">.</span><span class="n">schreier_sims</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S</span><span class="o">.</span><span class="n">base</span>
<span class="go">[0, 1, 2]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">base</span><span class="p">,</span> <span class="n">gens</span> <span class="o">=</span> <span class="n">S</span><span class="o">.</span><span class="n">baseswap</span><span class="p">(</span><span class="n">S</span><span class="o">.</span><span class="n">base</span><span class="p">,</span> <span class="n">S</span><span class="o">.</span><span class="n">strong_gens</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">randomized</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">base</span><span class="p">,</span> <span class="n">gens</span>
<span class="go">([0, 2, 1],</span>
<span class="go">[(0 1 2 3), (3)(0 1), (1 3 2),</span>
<span class="go"> (2 3), (1 3)])</span>
</pre></div>
</div>
<p>check that base, gens is a BSGS</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">S1</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">(</span><span class="n">gens</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">_verify_bsgs</span><span class="p">(</span><span class="n">S1</span><span class="p">,</span> <span class="n">base</span><span class="p">,</span> <span class="n">gens</span><span class="p">)</span>
<span class="go">True</span>
</pre></div>
</div>
<p class="rubric">Notes</p>
<p>The deterministic version of the algorithm is discussed in
[1], pp. 102-103; the randomized version is discussed in [1], p.103, and
[2], p.98. It is of Las Vegas type.
Notice that [1] contains a mistake in the pseudocode and
discussion of BASESWAP: on line 3 of the pseudocode,
<span class="math notranslate nohighlight">\(|\beta_{i+1}^{\left\langle T\right\rangle}|\)</span> should be replaced by
<span class="math notranslate nohighlight">\(|\beta_{i}^{\left\langle T\right\rangle}|\)</span>, and the same for the
discussion of the algorithm.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.schreier_sims" title="sympy.combinatorics.perm_groups.PermutationGroup.schreier_sims"><code class="xref py py-obj docutils literal notranslate"><span class="pre">schreier_sims</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.basic_orbits">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">basic_orbits</span></span><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.basic_orbits" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the basic orbits relative to a base and strong generating set.</p>
<p class="rubric">Explanation</p>
<p>If <span class="math notranslate nohighlight">\((b_1, b_2, ..., b_k)\)</span> is a base for a group <span class="math notranslate nohighlight">\(G\)</span>, and
<span class="math notranslate nohighlight">\(G^{(i)} = G_{b_1, b_2, ..., b_{i-1}}\)</span> is the <code class="docutils literal notranslate"><span class="pre">i</span></code>-th basic stabilizer
(so that <span class="math notranslate nohighlight">\(G^{(1)} = G\)</span>), the <code class="docutils literal notranslate"><span class="pre">i</span></code>-th basic orbit relative to this base
is the orbit of <span class="math notranslate nohighlight">\(b_i\)</span> under <span class="math notranslate nohighlight">\(G^{(i)}\)</span>. See [1], pp. 87-89 for more
information.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="n">SymmetricGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S</span> <span class="o">=</span> <span class="n">SymmetricGroup</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S</span><span class="o">.</span><span class="n">basic_orbits</span>
<span class="go">[[0, 1, 2, 3], [1, 2, 3], [2, 3]]</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.base" title="sympy.combinatorics.perm_groups.PermutationGroup.base"><code class="xref py py-obj docutils literal notranslate"><span class="pre">base</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.strong_gens" title="sympy.combinatorics.perm_groups.PermutationGroup.strong_gens"><code class="xref py py-obj docutils literal notranslate"><span class="pre">strong_gens</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.basic_transversals" title="sympy.combinatorics.perm_groups.PermutationGroup.basic_transversals"><code class="xref py py-obj docutils literal notranslate"><span class="pre">basic_transversals</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.basic_stabilizers" title="sympy.combinatorics.perm_groups.PermutationGroup.basic_stabilizers"><code class="xref py py-obj docutils literal notranslate"><span class="pre">basic_stabilizers</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.basic_stabilizers">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">basic_stabilizers</span></span><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.basic_stabilizers" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a chain of stabilizers relative to a base and strong generating
set.</p>
<p class="rubric">Explanation</p>
<p>The <code class="docutils literal notranslate"><span class="pre">i</span></code>-th basic stabilizer <span class="math notranslate nohighlight">\(G^{(i)}\)</span> relative to a base
<span class="math notranslate nohighlight">\((b_1, b_2, ..., b_k)\)</span> is <span class="math notranslate nohighlight">\(G_{b_1, b_2, ..., b_{i-1}}\)</span>. For more
information, see [1], pp. 87-89.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="n">AlternatingGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">A</span> <span class="o">=</span> <span class="n">AlternatingGroup</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">A</span><span class="o">.</span><span class="n">schreier_sims</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">A</span><span class="o">.</span><span class="n">base</span>
<span class="go">[0, 1]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">for</span> <span class="n">g</span> <span class="ow">in</span> <span class="n">A</span><span class="o">.</span><span class="n">basic_stabilizers</span><span class="p">:</span>
<span class="gp">... </span>    <span class="nb">print</span><span class="p">(</span><span class="n">g</span><span class="p">)</span>
<span class="gp">...</span>
<span class="go">PermutationGroup([</span>
<span class="go">    (3)(0 1 2),</span>
<span class="go">    (1 2 3)])</span>
<span class="go">PermutationGroup([</span>
<span class="go">    (1 2 3)])</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.base" title="sympy.combinatorics.perm_groups.PermutationGroup.base"><code class="xref py py-obj docutils literal notranslate"><span class="pre">base</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.strong_gens" title="sympy.combinatorics.perm_groups.PermutationGroup.strong_gens"><code class="xref py py-obj docutils literal notranslate"><span class="pre">strong_gens</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.basic_orbits" title="sympy.combinatorics.perm_groups.PermutationGroup.basic_orbits"><code class="xref py py-obj docutils literal notranslate"><span class="pre">basic_orbits</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.basic_transversals" title="sympy.combinatorics.perm_groups.PermutationGroup.basic_transversals"><code class="xref py py-obj docutils literal notranslate"><span class="pre">basic_transversals</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.basic_transversals">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">basic_transversals</span></span><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.basic_transversals" title="Permalink to this definition">¶</a></dt>
<dd><p>Return basic transversals relative to a base and strong generating set.</p>
<p class="rubric">Explanation</p>
<p>The basic transversals are transversals of the basic orbits. They
are provided as a list of dictionaries, each dictionary having
keys - the elements of one of the basic orbits, and values - the
corresponding transversal elements. See [1], pp. 87-89 for more
information.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="n">AlternatingGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">A</span> <span class="o">=</span> <span class="n">AlternatingGroup</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">A</span><span class="o">.</span><span class="n">basic_transversals</span>
<span class="go">[{0: (3), 1: (3)(0 1 2), 2: (3)(0 2 1), 3: (0 3 1)}, {1: (3), 2: (1 2 3), 3: (1 3 2)}]</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.strong_gens" title="sympy.combinatorics.perm_groups.PermutationGroup.strong_gens"><code class="xref py py-obj docutils literal notranslate"><span class="pre">strong_gens</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.base" title="sympy.combinatorics.perm_groups.PermutationGroup.base"><code class="xref py py-obj docutils literal notranslate"><span class="pre">base</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.basic_orbits" title="sympy.combinatorics.perm_groups.PermutationGroup.basic_orbits"><code class="xref py py-obj docutils literal notranslate"><span class="pre">basic_orbits</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.basic_stabilizers" title="sympy.combinatorics.perm_groups.PermutationGroup.basic_stabilizers"><code class="xref py py-obj docutils literal notranslate"><span class="pre">basic_stabilizers</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.center">
<span class="sig-name descname"><span class="pre">center</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L933-L967"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.center" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the center of a permutation group.</p>
<p class="rubric">Explanation</p>
<p>The center for a group <span class="math notranslate nohighlight">\(G\)</span> is defined as
<span class="math notranslate nohighlight">\(Z(G) = \{z\in G | \forall g\in G, zg = gz \}\)</span>,
the set of elements of <span class="math notranslate nohighlight">\(G\)</span> that commute with all elements of <span class="math notranslate nohighlight">\(G\)</span>.
It is equal to the centralizer of <span class="math notranslate nohighlight">\(G\)</span> inside <span class="math notranslate nohighlight">\(G\)</span>, and is naturally a
subgroup of <span class="math notranslate nohighlight">\(G\)</span> ([9]).</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="n">DihedralGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">D</span> <span class="o">=</span> <span class="n">DihedralGroup</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">D</span><span class="o">.</span><span class="n">center</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">order</span><span class="p">()</span>
<span class="go">2</span>
</pre></div>
</div>
<p class="rubric">Notes</p>
<p>This is a naive implementation that is a straightforward application
of <code class="docutils literal notranslate"><span class="pre">.centralizer()</span></code></p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.centralizer" title="sympy.combinatorics.perm_groups.PermutationGroup.centralizer"><code class="xref py py-obj docutils literal notranslate"><span class="pre">centralizer</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.centralizer">
<span class="sig-name descname"><span class="pre">centralizer</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">other</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L969-L1086"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.centralizer" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the centralizer of a group/set/element.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>other</strong></p>
<blockquote>
<div><p>a permutation group/list of permutations/single permutation</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Explanation</p>
<p>The centralizer of a set of permutations <code class="docutils literal notranslate"><span class="pre">S</span></code> inside
a group <code class="docutils literal notranslate"><span class="pre">G</span></code> is the set of elements of <code class="docutils literal notranslate"><span class="pre">G</span></code> that commute with all
elements of <code class="docutils literal notranslate"><span class="pre">S</span></code>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>`C_G(S) = \{ g \in G | gs = sg \forall s \in S\}` ([10])
</pre></div>
</div>
<p>Usually, <code class="docutils literal notranslate"><span class="pre">S</span></code> is a subset of <code class="docutils literal notranslate"><span class="pre">G</span></code>, but if <code class="docutils literal notranslate"><span class="pre">G</span></code> is a proper subgroup of
the full symmetric group, we allow for <code class="docutils literal notranslate"><span class="pre">S</span></code> to have elements outside
<code class="docutils literal notranslate"><span class="pre">G</span></code>.</p>
<p>It is naturally a subgroup of <code class="docutils literal notranslate"><span class="pre">G</span></code>; the centralizer of a permutation
group is equal to the centralizer of any set of generators for that
group, since any element commuting with the generators commutes with
any product of the  generators.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="p">(</span><span class="n">SymmetricGroup</span><span class="p">,</span>
<span class="gp">... </span><span class="n">CyclicGroup</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S</span> <span class="o">=</span> <span class="n">SymmetricGroup</span><span class="p">(</span><span class="mi">6</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">C</span> <span class="o">=</span> <span class="n">CyclicGroup</span><span class="p">(</span><span class="mi">6</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">H</span> <span class="o">=</span> <span class="n">S</span><span class="o">.</span><span class="n">centralizer</span><span class="p">(</span><span class="n">C</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">H</span><span class="o">.</span><span class="n">is_subgroup</span><span class="p">(</span><span class="n">C</span><span class="p">)</span>
<span class="go">True</span>
</pre></div>
</div>
<p class="rubric">Notes</p>
<p>The implementation is an application of <code class="docutils literal notranslate"><span class="pre">.subgroup_search()</span></code> with
tests using a specific base for the group <code class="docutils literal notranslate"><span class="pre">G</span></code>.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.subgroup_search" title="sympy.combinatorics.perm_groups.PermutationGroup.subgroup_search"><code class="xref py py-obj docutils literal notranslate"><span class="pre">subgroup_search</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.commutator">
<span class="sig-name descname"><span class="pre">commutator</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">G</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">H</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L1088-L1133"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.commutator" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the commutator of two subgroups.</p>
<p class="rubric">Explanation</p>
<p>For a permutation group <code class="docutils literal notranslate"><span class="pre">K</span></code> and subgroups <code class="docutils literal notranslate"><span class="pre">G</span></code>, <code class="docutils literal notranslate"><span class="pre">H</span></code>, the
commutator of <code class="docutils literal notranslate"><span class="pre">G</span></code> and <code class="docutils literal notranslate"><span class="pre">H</span></code> is defined as the group generated
by all the commutators <span class="math notranslate nohighlight">\([g, h] = hgh^{-1}g^{-1}\)</span> for <code class="docutils literal notranslate"><span class="pre">g</span></code> in <code class="docutils literal notranslate"><span class="pre">G</span></code> and
<code class="docutils literal notranslate"><span class="pre">h</span></code> in <code class="docutils literal notranslate"><span class="pre">H</span></code>. It is naturally a subgroup of <code class="docutils literal notranslate"><span class="pre">K</span></code> ([1], p.27).</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="p">(</span><span class="n">SymmetricGroup</span><span class="p">,</span>
<span class="gp">... </span><span class="n">AlternatingGroup</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S</span> <span class="o">=</span> <span class="n">SymmetricGroup</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">A</span> <span class="o">=</span> <span class="n">AlternatingGroup</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">S</span><span class="o">.</span><span class="n">commutator</span><span class="p">(</span><span class="n">S</span><span class="p">,</span> <span class="n">A</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">is_subgroup</span><span class="p">(</span><span class="n">A</span><span class="p">)</span>
<span class="go">True</span>
</pre></div>
</div>
<p class="rubric">Notes</p>
<p>The commutator of two subgroups <span class="math notranslate nohighlight">\(H, G\)</span> is equal to the normal closure
of the commutators of all the generators, i.e. <span class="math notranslate nohighlight">\(hgh^{-1}g^{-1}\)</span> for <span class="math notranslate nohighlight">\(h\)</span>
a generator of <span class="math notranslate nohighlight">\(H\)</span> and <span class="math notranslate nohighlight">\(g\)</span> a generator of <span class="math notranslate nohighlight">\(G\)</span> ([1], p.28)</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.derived_subgroup" title="sympy.combinatorics.perm_groups.PermutationGroup.derived_subgroup"><code class="xref py py-obj docutils literal notranslate"><span class="pre">derived_subgroup</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.composition_series">
<span class="sig-name descname"><span class="pre">composition_series</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L724-L796"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.composition_series" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the composition series for a group as a list
of permutation groups.</p>
<p class="rubric">Explanation</p>
<p>The composition series for a group <span class="math notranslate nohighlight">\(G\)</span> is defined as a
subnormal series <span class="math notranslate nohighlight">\(G = H_0 &gt; H_1 &gt; H_2 \ldots\)</span> A composition
series is a subnormal series such that each factor group
<span class="math notranslate nohighlight">\(H(i+1) / H(i)\)</span> is simple.
A subnormal series is a composition series only if it is of
maximum length.</p>
<p>The algorithm works as follows:
Starting with the derived series the idea is to fill
the gap between <span class="math notranslate nohighlight">\(G = der[i]\)</span> and <span class="math notranslate nohighlight">\(H = der[i+1]\)</span> for each
<span class="math notranslate nohighlight">\(i\)</span> independently. Since, all subgroups of the abelian group
<span class="math notranslate nohighlight">\(G/H\)</span> are normal so, first step is to take the generators
<span class="math notranslate nohighlight">\(g\)</span> of <span class="math notranslate nohighlight">\(G\)</span> and add them to generators of <span class="math notranslate nohighlight">\(H\)</span> one by one.</p>
<p>The factor groups formed are not simple in general. Each
group is obtained from the previous one by adding one
generator <span class="math notranslate nohighlight">\(g\)</span>, if the previous group is denoted by <span class="math notranslate nohighlight">\(H\)</span>
then the next group <span class="math notranslate nohighlight">\(K\)</span> is generated by <span class="math notranslate nohighlight">\(g\)</span> and <span class="math notranslate nohighlight">\(H\)</span>.
The factor group <span class="math notranslate nohighlight">\(K/H\)</span> is cyclic and it’s order is
<span class="math notranslate nohighlight">\(K.order()//G.order()\)</span>. The series is then extended between
<span class="math notranslate nohighlight">\(K\)</span> and <span class="math notranslate nohighlight">\(H\)</span> by groups generated by powers of <span class="math notranslate nohighlight">\(g\)</span> and <span class="math notranslate nohighlight">\(H\)</span>.
The series formed is then prepended to the already existing
series.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="n">SymmetricGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="n">CyclicGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S</span> <span class="o">=</span> <span class="n">SymmetricGroup</span><span class="p">(</span><span class="mi">12</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">S</span><span class="o">.</span><span class="n">sylow_subgroup</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">C</span> <span class="o">=</span> <span class="n">G</span><span class="o">.</span><span class="n">composition_series</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="p">[</span><span class="n">H</span><span class="o">.</span><span class="n">order</span><span class="p">()</span> <span class="k">for</span> <span class="n">H</span> <span class="ow">in</span> <span class="n">C</span><span class="p">]</span>
<span class="go">[1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">S</span><span class="o">.</span><span class="n">sylow_subgroup</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">C</span> <span class="o">=</span> <span class="n">G</span><span class="o">.</span><span class="n">composition_series</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="p">[</span><span class="n">H</span><span class="o">.</span><span class="n">order</span><span class="p">()</span> <span class="k">for</span> <span class="n">H</span> <span class="ow">in</span> <span class="n">C</span><span class="p">]</span>
<span class="go">[243, 81, 27, 9, 3, 1]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">CyclicGroup</span><span class="p">(</span><span class="mi">12</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">C</span> <span class="o">=</span> <span class="n">G</span><span class="o">.</span><span class="n">composition_series</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="p">[</span><span class="n">H</span><span class="o">.</span><span class="n">order</span><span class="p">()</span> <span class="k">for</span> <span class="n">H</span> <span class="ow">in</span> <span class="n">C</span><span class="p">]</span>
<span class="go">[12, 6, 3, 1]</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.conjugacy_class">
<span class="sig-name descname"><span class="pre">conjugacy_class</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">x</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L2652-L2710"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.conjugacy_class" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the conjugacy class of an element in the group.</p>
<p class="rubric">Explanation</p>
<p>The conjugacy class of an element <code class="docutils literal notranslate"><span class="pre">g</span></code> in a group <code class="docutils literal notranslate"><span class="pre">G</span></code> is the set of
elements <code class="docutils literal notranslate"><span class="pre">x</span></code> in <code class="docutils literal notranslate"><span class="pre">G</span></code> that are conjugate with <code class="docutils literal notranslate"><span class="pre">g</span></code>, i.e. for which</p>
<blockquote>
<div><p><code class="docutils literal notranslate"><span class="pre">g</span> <span class="pre">=</span> <span class="pre">xax^{-1}</span></code></p>
</div></blockquote>
<p>for some <code class="docutils literal notranslate"><span class="pre">a</span></code> in <code class="docutils literal notranslate"><span class="pre">G</span></code>.</p>
<p>Note that conjugacy is an equivalence relation, and therefore that
conjugacy classes are partitions of <code class="docutils literal notranslate"><span class="pre">G</span></code>. For a list of all the
conjugacy classes of the group, use the conjugacy_classes() method.</p>
<p>In a permutation group, each conjugacy class corresponds to a particular
<span class="math notranslate nohighlight">\(cycle structure': for example, in \)</span>, the conjugacy classes are:</p>
<blockquote>
<div><ul class="simple">
<li><p>the identity class, <code class="docutils literal notranslate"><span class="pre">{()}</span></code></p></li>
<li><p>all transpositions, <code class="docutils literal notranslate"><span class="pre">{(1</span> <span class="pre">2),</span> <span class="pre">(1</span> <span class="pre">3),</span> <span class="pre">(2</span> <span class="pre">3)}</span></code></p></li>
<li><p>all 3-cycles, <code class="docutils literal notranslate"><span class="pre">{(1</span> <span class="pre">2</span> <span class="pre">3),</span> <span class="pre">(1</span> <span class="pre">3</span> <span class="pre">2)}</span></code></p></li>
</ul>
</div></blockquote>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.permutations</span> <span class="kn">import</span> <span class="n">Permutation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="n">SymmetricGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S3</span> <span class="o">=</span> <span class="n">SymmetricGroup</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S3</span><span class="o">.</span><span class="n">conjugacy_class</span><span class="p">(</span><span class="n">Permutation</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">))</span>
<span class="go">{(0 1 2), (0 2 1)}</span>
</pre></div>
</div>
<p class="rubric">Notes</p>
<p>This procedure computes the conjugacy class directly by finding the
orbit of the element under conjugation in G. This algorithm is only
feasible for permutation groups of relatively small order, but is like
the orbit() function itself in that respect.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.conjugacy_classes">
<span class="sig-name descname"><span class="pre">conjugacy_classes</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L2713-L2742"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.conjugacy_classes" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the conjugacy classes of the group.</p>
<p class="rubric">Explanation</p>
<p>As described in the documentation for the .conjugacy_class() function,
conjugacy is an equivalence relation on a group G which partitions the
set of elements. This method returns a list of all these conjugacy
classes of G.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">SymmetricGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">SymmetricGroup</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span><span class="o">.</span><span class="n">conjugacy_classes</span><span class="p">()</span>
<span class="go">[{(2)}, {(0 1 2), (0 2 1)}, {(0 2), (1 2), (2)(0 1)}]</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.contains">
<span class="sig-name descname"><span class="pre">contains</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">g</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">strict</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L1709-L1770"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.contains" title="Permalink to this definition">¶</a></dt>
<dd><p>Test if permutation <code class="docutils literal notranslate"><span class="pre">g</span></code> belong to self, <code class="docutils literal notranslate"><span class="pre">G</span></code>.</p>
<p class="rubric">Explanation</p>
<p>If <code class="docutils literal notranslate"><span class="pre">g</span></code> is an element of <code class="docutils literal notranslate"><span class="pre">G</span></code> it can be written as a product
of factors drawn from the cosets of <code class="docutils literal notranslate"><span class="pre">G</span></code>’s stabilizers. To see
if <code class="docutils literal notranslate"><span class="pre">g</span></code> is one of the actual generators defining the group use
<code class="docutils literal notranslate"><span class="pre">G.has(g)</span></code>.</p>
<p>If <code class="docutils literal notranslate"><span class="pre">strict</span></code> is not <code class="docutils literal notranslate"><span class="pre">True</span></code>, <code class="docutils literal notranslate"><span class="pre">g</span></code> will be resized, if necessary,
to match the size of permutations in <code class="docutils literal notranslate"><span class="pre">self</span></code>.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">Permutation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.perm_groups</span> <span class="kn">import</span> <span class="n">PermutationGroup</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">,</span> <span class="n">degree</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">contains</span><span class="p">(</span><span class="n">G</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="c1"># trivial check</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">elem</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">]],</span> <span class="n">size</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">contains</span><span class="p">(</span><span class="n">elem</span><span class="p">)</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">contains</span><span class="p">(</span><span class="n">Permutation</span><span class="p">(</span><span class="mi">4</span><span class="p">)(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">))</span>
<span class="go">False</span>
</pre></div>
</div>
<p>If strict is False, a permutation will be resized, if
necessary:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">H</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">(</span><span class="n">Permutation</span><span class="p">(</span><span class="mi">5</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">H</span><span class="o">.</span><span class="n">contains</span><span class="p">(</span><span class="n">Permutation</span><span class="p">(</span><span class="mi">3</span><span class="p">))</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">H</span><span class="o">.</span><span class="n">contains</span><span class="p">(</span><span class="n">Permutation</span><span class="p">(</span><span class="mi">3</span><span class="p">),</span> <span class="n">strict</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="go">True</span>
</pre></div>
</div>
<p>To test if a given permutation is present in the group:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">elem</span> <span class="ow">in</span> <span class="n">G</span><span class="o">.</span><span class="n">generators</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">has</span><span class="p">(</span><span class="n">elem</span><span class="p">)</span>
<span class="go">False</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.coset_factor" title="sympy.combinatorics.perm_groups.PermutationGroup.coset_factor"><code class="xref py py-obj docutils literal notranslate"><span class="pre">coset_factor</span></code></a>, <a class="reference internal" href="../core.html#sympy.core.basic.Basic.has" title="sympy.core.basic.Basic.has"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.core.basic.Basic.has</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.__contains__" title="sympy.combinatorics.perm_groups.PermutationGroup.__contains__"><code class="xref py py-obj docutils literal notranslate"><span class="pre">__contains__</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.coset_factor">
<span class="sig-name descname"><span class="pre">coset_factor</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">g</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">factor_index</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L1135-L1224"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.coset_factor" title="Permalink to this definition">¶</a></dt>
<dd><p>Return <code class="docutils literal notranslate"><span class="pre">G</span></code>’s (self’s) coset factorization of <code class="docutils literal notranslate"><span class="pre">g</span></code></p>
<p class="rubric">Explanation</p>
<p>If <code class="docutils literal notranslate"><span class="pre">g</span></code> is an element of <code class="docutils literal notranslate"><span class="pre">G</span></code> then it can be written as the product
of permutations drawn from the Schreier-Sims coset decomposition,</p>
<p>The permutations returned in <code class="docutils literal notranslate"><span class="pre">f</span></code> are those for which
the product gives <code class="docutils literal notranslate"><span class="pre">g</span></code>: <code class="docutils literal notranslate"><span class="pre">g</span> <span class="pre">=</span> <span class="pre">f[n]*...f[1]*f[0]</span></code> where <code class="docutils literal notranslate"><span class="pre">n</span> <span class="pre">=</span> <span class="pre">len(B)</span></code>
and <code class="docutils literal notranslate"><span class="pre">B</span> <span class="pre">=</span> <span class="pre">G.base</span></code>. f[i] is one of the permutations in
<code class="docutils literal notranslate"><span class="pre">self._basic_orbits[i]</span></code>.</p>
<p>If factor_index==True,
returns a tuple <code class="docutils literal notranslate"><span class="pre">[b[0],..,b[n]]</span></code>, where <code class="docutils literal notranslate"><span class="pre">b[i]</span></code>
belongs to <code class="docutils literal notranslate"><span class="pre">self._basic_orbits[i]</span></code></p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">Permutation</span><span class="p">,</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">4</span><span class="p">)(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">2</span><span class="p">)(</span><span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">6</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">])</span>
</pre></div>
</div>
<p>Define g:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">g</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">(</span><span class="mi">7</span><span class="p">)(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">4</span><span class="p">)(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
</pre></div>
</div>
<p>Confirm that it is an element of G:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">contains</span><span class="p">(</span><span class="n">g</span><span class="p">)</span>
<span class="go">True</span>
</pre></div>
</div>
<p>Thus, it can be written as a product of factors (up to
3) drawn from u. See below that a factor from u1 and u2
and the Identity permutation have been used:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">f</span> <span class="o">=</span> <span class="n">G</span><span class="o">.</span><span class="n">coset_factor</span><span class="p">(</span><span class="n">g</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">f</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">*</span><span class="n">f</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">*</span><span class="n">f</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">g</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">f1</span> <span class="o">=</span> <span class="n">G</span><span class="o">.</span><span class="n">coset_factor</span><span class="p">(</span><span class="n">g</span><span class="p">,</span> <span class="kc">True</span><span class="p">);</span> <span class="n">f1</span>
<span class="go">[0, 4, 4]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">tr</span> <span class="o">=</span> <span class="n">G</span><span class="o">.</span><span class="n">basic_transversals</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">f</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">tr</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="n">f1</span><span class="p">[</span><span class="mi">0</span><span class="p">]]</span>
<span class="go">True</span>
</pre></div>
</div>
<p>If g is not an element of G then [] is returned:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">c</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">7</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">coset_factor</span><span class="p">(</span><span class="n">c</span><span class="p">)</span>
<span class="go">[]</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="util.html#sympy.combinatorics.util._strip" title="sympy.combinatorics.util._strip"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.combinatorics.util._strip</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.coset_rank">
<span class="sig-name descname"><span class="pre">coset_rank</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">g</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L1267-L1313"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.coset_rank" title="Permalink to this definition">¶</a></dt>
<dd><p>rank using Schreier-Sims representation.</p>
<p class="rubric">Explanation</p>
<p>The coset rank of <code class="docutils literal notranslate"><span class="pre">g</span></code> is the ordering number in which
it appears in the lexicographic listing according to the
coset decomposition</p>
<p>The ordering is the same as in G.generate(method=’coset’).
If <code class="docutils literal notranslate"><span class="pre">g</span></code> does not belong to the group it returns None.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">Permutation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.perm_groups</span> <span class="kn">import</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">4</span><span class="p">)(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">2</span><span class="p">)(</span><span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">6</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">c</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">(</span><span class="mi">7</span><span class="p">)(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">4</span><span class="p">)(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">coset_rank</span><span class="p">(</span><span class="n">c</span><span class="p">)</span>
<span class="go">16</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">coset_unrank</span><span class="p">(</span><span class="mi">16</span><span class="p">)</span>
<span class="go">(7)(2 4)(3 5)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.coset_factor" title="sympy.combinatorics.perm_groups.PermutationGroup.coset_factor"><code class="xref py py-obj docutils literal notranslate"><span class="pre">coset_factor</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.coset_table">
<span class="sig-name descname"><span class="pre">coset_table</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">H</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L888-L931"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.coset_table" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the standardised (right) coset table of self in H as
a list of lists.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.coset_transversal">
<span class="sig-name descname"><span class="pre">coset_transversal</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">H</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L798-L859"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.coset_transversal" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a transversal of the right cosets of self by its subgroup H
using the second method described in [1], Subsection 4.6.7</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.coset_unrank">
<span class="sig-name descname"><span class="pre">coset_unrank</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rank</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">af</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L1315-L1337"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.coset_unrank" title="Permalink to this definition">¶</a></dt>
<dd><p>unrank using Schreier-Sims representation</p>
<p>coset_unrank is the inverse operation of coset_rank
if 0 &lt;= rank &lt; order; otherwise it returns None.</p>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.degree">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">degree</span></span><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.degree" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the size of the permutations in the group.</p>
<p class="rubric">Explanation</p>
<p>The number of permutations comprising the group is given by
<code class="docutils literal notranslate"><span class="pre">len(group)</span></code>; the number of permutations that can be generated
by the group is given by <code class="docutils literal notranslate"><span class="pre">group.order()</span></code>.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">Permutation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.perm_groups</span> <span class="kn">import</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">a</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">degree</span>
<span class="go">3</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">len</span><span class="p">(</span><span class="n">G</span><span class="p">)</span>
<span class="go">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">order</span><span class="p">()</span>
<span class="go">2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">generate</span><span class="p">())</span>
<span class="go">[(2), (2)(0 1)]</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.order" title="sympy.combinatorics.perm_groups.PermutationGroup.order"><code class="xref py py-obj docutils literal notranslate"><span class="pre">order</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.derived_series">
<span class="sig-name descname"><span class="pre">derived_series</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L1411-L1458"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.derived_series" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the derived series for the group.</p>
<dl class="field-list">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A list of permutation groups containing the members of the derived</p>
<p>series in the order <span class="math notranslate nohighlight">\(G = G_0, G_1, G_2, \ldots\)</span>.</p>
</dd>
</dl>
<p class="rubric">Explanation</p>
<p>The derived series for a group <span class="math notranslate nohighlight">\(G\)</span> is defined as
<span class="math notranslate nohighlight">\(G = G_0 &gt; G_1 &gt; G_2 &gt; \ldots\)</span> where <span class="math notranslate nohighlight">\(G_i = [G_{i-1}, G_{i-1}]\)</span>,
i.e. <span class="math notranslate nohighlight">\(G_i\)</span> is the derived subgroup of <span class="math notranslate nohighlight">\(G_{i-1}\)</span>, for
<span class="math notranslate nohighlight">\(i\in\mathbb{N}\)</span>. When we have <span class="math notranslate nohighlight">\(G_k = G_{k-1}\)</span> for some
<span class="math notranslate nohighlight">\(k\in\mathbb{N}\)</span>, the series terminates.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="p">(</span><span class="n">SymmetricGroup</span><span class="p">,</span>
<span class="gp">... </span><span class="n">AlternatingGroup</span><span class="p">,</span> <span class="n">DihedralGroup</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">A</span> <span class="o">=</span> <span class="n">AlternatingGroup</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">len</span><span class="p">(</span><span class="n">A</span><span class="o">.</span><span class="n">derived_series</span><span class="p">())</span>
<span class="go">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S</span> <span class="o">=</span> <span class="n">SymmetricGroup</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">len</span><span class="p">(</span><span class="n">S</span><span class="o">.</span><span class="n">derived_series</span><span class="p">())</span>
<span class="go">4</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S</span><span class="o">.</span><span class="n">derived_series</span><span class="p">()[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">is_subgroup</span><span class="p">(</span><span class="n">AlternatingGroup</span><span class="p">(</span><span class="mi">4</span><span class="p">))</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S</span><span class="o">.</span><span class="n">derived_series</span><span class="p">()[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">is_subgroup</span><span class="p">(</span><span class="n">DihedralGroup</span><span class="p">(</span><span class="mi">2</span><span class="p">))</span>
<span class="go">True</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.derived_subgroup" title="sympy.combinatorics.perm_groups.PermutationGroup.derived_subgroup"><code class="xref py py-obj docutils literal notranslate"><span class="pre">derived_subgroup</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.derived_subgroup">
<span class="sig-name descname"><span class="pre">derived_subgroup</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L1460-L1506"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.derived_subgroup" title="Permalink to this definition">¶</a></dt>
<dd><p>Compute the derived subgroup.</p>
<p class="rubric">Explanation</p>
<p>The derived subgroup, or commutator subgroup is the subgroup generated
by all commutators <span class="math notranslate nohighlight">\([g, h] = hgh^{-1}g^{-1}\)</span> for <span class="math notranslate nohighlight">\(g, h\in G\)</span> ; it is
equal to the normal closure of the set of commutators of the generators
([1], p.28, [11]).</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">Permutation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.perm_groups</span> <span class="kn">import</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">3</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">4</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">C</span> <span class="o">=</span> <span class="n">G</span><span class="o">.</span><span class="n">derived_subgroup</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">list</span><span class="p">(</span><span class="n">C</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">af</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span>
<span class="go">[[0, 1, 2, 3, 4], [0, 1, 3, 4, 2], [0, 1, 4, 2, 3]]</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.derived_series" title="sympy.combinatorics.perm_groups.PermutationGroup.derived_series"><code class="xref py py-obj docutils literal notranslate"><span class="pre">derived_series</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.elements">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">elements</span></span><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.elements" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns all the elements of the permutation group as a set</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">Permutation</span><span class="p">,</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">(</span><span class="n">Permutation</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">),</span> <span class="n">Permutation</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">elements</span>
<span class="go">{(1 2 3), (1 3 2), (1 3), (2 3), (3), (3)(1 2)}</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.generate">
<span class="sig-name descname"><span class="pre">generate</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">method</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'coset'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">af</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L1508-L1559"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.generate" title="Permalink to this definition">¶</a></dt>
<dd><p>Return iterator to generate the elements of the group.</p>
<p class="rubric">Explanation</p>
<p>Iteration is done with one of these methods:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">method</span><span class="o">=</span><span class="s1">&#39;coset&#39;</span>  <span class="n">using</span> <span class="n">the</span> <span class="n">Schreier</span><span class="o">-</span><span class="n">Sims</span> <span class="n">coset</span> <span class="n">representation</span>
<span class="n">method</span><span class="o">=</span><span class="s1">&#39;dimino&#39;</span> <span class="n">using</span> <span class="n">the</span> <span class="n">Dimino</span> <span class="n">method</span>
</pre></div>
</div>
<p>If <code class="docutils literal notranslate"><span class="pre">af</span> <span class="pre">=</span> <span class="pre">True</span></code> it yields the array form of the permutations</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.polyhedron</span> <span class="kn">import</span> <span class="n">tetrahedron</span>
</pre></div>
</div>
<p>The permutation group given in the tetrahedron object is also
true groups:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">tetrahedron</span><span class="o">.</span><span class="n">pgroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">is_group</span>
<span class="go">True</span>
</pre></div>
</div>
<p>Also the group generated by the permutations in the tetrahedron
pgroup – even the first two – is a proper group:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">H</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">(</span><span class="n">G</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">G</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">J</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="n">H</span><span class="o">.</span><span class="n">generate</span><span class="p">()));</span> <span class="n">J</span>
<span class="go">PermutationGroup([</span>
<span class="go">    (0 1)(2 3),</span>
<span class="go">    (1 2 3),</span>
<span class="go">    (1 3 2),</span>
<span class="go">    (0 3 1),</span>
<span class="go">    (0 2 3),</span>
<span class="go">    (0 3)(1 2),</span>
<span class="go">    (0 1 3),</span>
<span class="go">    (3)(0 2 1),</span>
<span class="go">    (0 3 2),</span>
<span class="go">    (3)(0 1 2),</span>
<span class="go">    (0 2)(1 3)])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">_</span><span class="o">.</span><span class="n">is_group</span>
<span class="go">True</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.generate_dimino">
<span class="sig-name descname"><span class="pre">generate_dimino</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">af</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L1561-L1618"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.generate_dimino" title="Permalink to this definition">¶</a></dt>
<dd><p>Yield group elements using Dimino’s algorithm.</p>
<p>If <code class="docutils literal notranslate"><span class="pre">af</span> <span class="pre">==</span> <span class="pre">True</span></code> it yields the array form of the permutations.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">Permutation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.perm_groups</span> <span class="kn">import</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">1</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">g</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">list</span><span class="p">(</span><span class="n">g</span><span class="o">.</span><span class="n">generate_dimino</span><span class="p">(</span><span class="n">af</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span>
<span class="go">[[0, 1, 2, 3], [0, 2, 1, 3], [0, 2, 3, 1],</span>
<span class="go"> [0, 1, 3, 2], [0, 3, 2, 1], [0, 3, 1, 2]]</span>
</pre></div>
</div>
<p class="rubric">References</p>
<dl class="citation">
<dt class="label" id="r59"><span class="brackets"><a class="fn-backref" href="#id24">R59</a></span></dt>
<dd><p>The Implementation of Various Algorithms for Permutation Groups in
the Computer Algebra System: AXIOM, N.J. Doye, M.Sc. Thesis</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.generate_schreier_sims">
<span class="sig-name descname"><span class="pre">generate_schreier_sims</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">af</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L1620-L1689"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.generate_schreier_sims" title="Permalink to this definition">¶</a></dt>
<dd><p>Yield group elements using the Schreier-Sims representation
in coset_rank order</p>
<p>If <code class="docutils literal notranslate"><span class="pre">af</span> <span class="pre">=</span> <span class="pre">True</span></code> it yields the array form of the permutations</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">Permutation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.perm_groups</span> <span class="kn">import</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">1</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">g</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">list</span><span class="p">(</span><span class="n">g</span><span class="o">.</span><span class="n">generate_schreier_sims</span><span class="p">(</span><span class="n">af</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span>
<span class="go">[[0, 1, 2, 3], [0, 2, 1, 3], [0, 3, 2, 1],</span>
<span class="go"> [0, 1, 3, 2], [0, 2, 3, 1], [0, 3, 1, 2]]</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.generator_product">
<span class="sig-name descname"><span class="pre">generator_product</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">g</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">original</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L1226-L1265"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.generator_product" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a list of strong generators <span class="math notranslate nohighlight">\([s1, ..., sn]\)</span>
s.t <span class="math notranslate nohighlight">\(g = sn*...*s1\)</span>. If <span class="math notranslate nohighlight">\(original=True\)</span>, make the list
contain only the original group generators</p>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.generators">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">generators</span></span><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.generators" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the generators of the group.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">Permutation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.perm_groups</span> <span class="kn">import</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">generators</span>
<span class="go">[(1 2), (2)(0 1)]</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.identity">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">identity</span></span><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.identity" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the identity element of the permutation group.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.index">
<span class="sig-name descname"><span class="pre">index</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">H</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L3025-L3043"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.index" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the index of a permutation group.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.permutations</span> <span class="kn">import</span> <span class="n">Permutation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.perm_groups</span> <span class="kn">import</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span><span class="n">Permutation</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">a</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">H</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">b</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">H</span><span class="p">)</span>
<span class="go">3</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.is_abelian">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">is_abelian</span></span><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.is_abelian" title="Permalink to this definition">¶</a></dt>
<dd><p>Test if the group is Abelian.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">Permutation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.perm_groups</span> <span class="kn">import</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">is_abelian</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">a</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">is_abelian</span>
<span class="go">True</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.is_alt_sym">
<span class="sig-name descname"><span class="pre">is_alt_sym</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">eps</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.05</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">_random_prec</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L1994-L2053"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.is_alt_sym" title="Permalink to this definition">¶</a></dt>
<dd><p>Monte Carlo test for the symmetric/alternating group for degrees
&gt;= 8.</p>
<p class="rubric">Explanation</p>
<p>More specifically, it is one-sided Monte Carlo with the
answer True (i.e., G is symmetric/alternating) guaranteed to be
correct, and the answer False being incorrect with probability eps.</p>
<p>For degree &lt; 8, the order of the group is checked so the test
is deterministic.</p>
<p class="rubric">Notes</p>
<p>The algorithm itself uses some nontrivial results from group theory and
number theory:
1) If a transitive group <code class="docutils literal notranslate"><span class="pre">G</span></code> of degree <code class="docutils literal notranslate"><span class="pre">n</span></code> contains an element
with a cycle of length <code class="docutils literal notranslate"><span class="pre">n/2</span> <span class="pre">&lt;</span> <span class="pre">p</span> <span class="pre">&lt;</span> <span class="pre">n-2</span></code> for <code class="docutils literal notranslate"><span class="pre">p</span></code> a prime, <code class="docutils literal notranslate"><span class="pre">G</span></code> is the
symmetric or alternating group ([1], pp. 81-82)
2) The proportion of elements in the symmetric/alternating group having
the property described in 1) is approximately <span class="math notranslate nohighlight">\(\log(2)/\log(n)\)</span>
([1], p.82; [2], pp. 226-227).
The helper function <code class="docutils literal notranslate"><span class="pre">_check_cycles_alt_sym</span></code> is used to
go over the cycles in a permutation and look for ones satisfying 1).</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="n">DihedralGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">D</span> <span class="o">=</span> <span class="n">DihedralGroup</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">D</span><span class="o">.</span><span class="n">is_alt_sym</span><span class="p">()</span>
<span class="go">False</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="util.html#sympy.combinatorics.util._check_cycles_alt_sym" title="sympy.combinatorics.util._check_cycles_alt_sym"><code class="xref py py-obj docutils literal notranslate"><span class="pre">_check_cycles_alt_sym</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.is_alternating">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">is_alternating</span></span><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.is_alternating" title="Permalink to this definition">¶</a></dt>
<dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if the group is alternating.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="n">AlternatingGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">g</span> <span class="o">=</span> <span class="n">AlternatingGroup</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">g</span><span class="o">.</span><span class="n">is_alternating</span>
<span class="go">True</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">Permutation</span><span class="p">,</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">g</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">(</span>
<span class="gp">... </span>    <span class="n">Permutation</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">),</span>
<span class="gp">... </span>    <span class="n">Permutation</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">g</span><span class="o">.</span><span class="n">is_alternating</span>
<span class="go">True</span>
</pre></div>
</div>
<p class="rubric">Notes</p>
<p>This uses a naive test involving the computation of the full
group order.
If you need more quicker taxonomy for large groups, you can use
<a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.is_alt_sym" title="sympy.combinatorics.perm_groups.PermutationGroup.is_alt_sym"><code class="xref py py-meth docutils literal notranslate"><span class="pre">PermutationGroup.is_alt_sym()</span></code></a>.
However, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.is_alt_sym" title="sympy.combinatorics.perm_groups.PermutationGroup.is_alt_sym"><code class="xref py py-meth docutils literal notranslate"><span class="pre">PermutationGroup.is_alt_sym()</span></code></a> may not be accurate
and is not able to distinguish between an alternating group and
a symmetric group.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.is_alt_sym" title="sympy.combinatorics.perm_groups.PermutationGroup.is_alt_sym"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_alt_sym</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.is_cyclic">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">is_cyclic</span></span><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.is_cyclic" title="Permalink to this definition">¶</a></dt>
<dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if the group is Cyclic.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="n">AbelianGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">AbelianGroup</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">is_cyclic</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">AbelianGroup</span><span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">is_cyclic</span>
<span class="go">False</span>
</pre></div>
</div>
<p class="rubric">Notes</p>
<p>If the order of a group <span class="math notranslate nohighlight">\(n\)</span> can be factored into the distinct
primes <span class="math notranslate nohighlight">\(p_1, p_2, ... , p_s\)</span> and if</p>
<div class="math notranslate nohighlight">
\[\forall i, j \in \{1, 2, \ldots, s \}:
p_i \not \equiv 1 \pmod {p_j}\]</div>
<p>holds true, there is only one group of the order <span class="math notranslate nohighlight">\(n\)</span> which
is a cyclic group. <a class="reference internal" href="#r60" id="id25"><span>[R60]</span></a> This is a generalization of the lemma
that the group of order <span class="math notranslate nohighlight">\(15, 35, ...\)</span> are cyclic.</p>
<p>And also, these additional lemmas can be used to test if a
group is cyclic if the order of the group is already found.</p>
<ul class="simple">
<li><p>If the group is abelian and the order of the group is
square-free, the group is cyclic.</p></li>
<li><p>If the order of the group is less than <span class="math notranslate nohighlight">\(6\)</span> and is not <span class="math notranslate nohighlight">\(4\)</span>, the
group is cyclic.</p></li>
<li><p>If the order of the group is prime, the group is cyclic.</p></li>
</ul>
<p class="rubric">References</p>
<dl class="citation">
<dt class="label" id="r60"><span class="brackets">R60</span><span class="fn-backref">(<a href="#id25">1</a>,<a href="#id26">2</a>)</span></dt>
<dd><p>1978: John S. Rose: A Course on Group Theory,
Introduction to Finite Group Theory: 1.4</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.is_elementary">
<span class="sig-name descname"><span class="pre">is_elementary</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L1902-L1925"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.is_elementary" title="Permalink to this definition">¶</a></dt>
<dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if the group is elementary abelian. An elementary
abelian group is a finite abelian group, where every nontrivial
element has order <span class="math notranslate nohighlight">\(p\)</span>, where <span class="math notranslate nohighlight">\(p\)</span> is a prime.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">Permutation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.perm_groups</span> <span class="kn">import</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">a</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">is_elementary</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">3</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">is_elementary</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">is_elementary</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span>
<span class="go">False</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.is_nilpotent">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">is_nilpotent</span></span><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.is_nilpotent" title="Permalink to this definition">¶</a></dt>
<dd><p>Test if the group is nilpotent.</p>
<p class="rubric">Explanation</p>
<p>A group <span class="math notranslate nohighlight">\(G\)</span> is nilpotent if it has a central series of finite length.
Alternatively, <span class="math notranslate nohighlight">\(G\)</span> is nilpotent if its lower central series terminates
with the trivial group. Every nilpotent group is also solvable
([1], p.29, [12]).</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="p">(</span><span class="n">SymmetricGroup</span><span class="p">,</span>
<span class="gp">... </span><span class="n">CyclicGroup</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">C</span> <span class="o">=</span> <span class="n">CyclicGroup</span><span class="p">(</span><span class="mi">6</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">C</span><span class="o">.</span><span class="n">is_nilpotent</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S</span> <span class="o">=</span> <span class="n">SymmetricGroup</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S</span><span class="o">.</span><span class="n">is_nilpotent</span>
<span class="go">False</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.lower_central_series" title="sympy.combinatorics.perm_groups.PermutationGroup.lower_central_series"><code class="xref py py-obj docutils literal notranslate"><span class="pre">lower_central_series</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.is_solvable" title="sympy.combinatorics.perm_groups.PermutationGroup.is_solvable"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_solvable</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.is_normal">
<span class="sig-name descname"><span class="pre">is_normal</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">gr</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">strict</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L2101-L2146"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.is_normal" title="Permalink to this definition">¶</a></dt>
<dd><p>Test if <code class="docutils literal notranslate"><span class="pre">G=self</span></code> is a normal subgroup of <code class="docutils literal notranslate"><span class="pre">gr</span></code>.</p>
<p class="rubric">Explanation</p>
<p>G is normal in gr if
for each g2 in G, g1 in gr, <code class="docutils literal notranslate"><span class="pre">g</span> <span class="pre">=</span> <span class="pre">g1*g2*g1**-1</span></code> belongs to G
It is sufficient to check this for each g1 in gr.generators and
g2 in G.generators.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">Permutation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.perm_groups</span> <span class="kn">import</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G1</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">a</span><span class="p">,</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">])])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G1</span><span class="o">.</span><span class="n">is_normal</span><span class="p">(</span><span class="n">G</span><span class="p">)</span>
<span class="go">True</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.is_perfect">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">is_perfect</span></span><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.is_perfect" title="Permalink to this definition">¶</a></dt>
<dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if the group is perfect.
A group is perfect if it equals to its derived subgroup.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">Permutation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.perm_groups</span> <span class="kn">import</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">)(</span><span class="mi">4</span><span class="p">,</span><span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">4</span><span class="p">,</span><span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">is_perfect</span>
<span class="go">False</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.is_polycyclic">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">is_polycyclic</span></span><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.is_polycyclic" title="Permalink to this definition">¶</a></dt>
<dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if a group is polycyclic. A group is polycyclic if
it has a subnormal series with cyclic factors. For finite groups,
this is the same as if the group is solvable.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">Permutation</span><span class="p">,</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">is_polycyclic</span>
<span class="go">True</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.is_primitive">
<span class="sig-name descname"><span class="pre">is_primitive</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">randomized</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L2148-L2209"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.is_primitive" title="Permalink to this definition">¶</a></dt>
<dd><p>Test if a group is primitive.</p>
<p class="rubric">Explanation</p>
<p>A permutation group <code class="docutils literal notranslate"><span class="pre">G</span></code> acting on a set <code class="docutils literal notranslate"><span class="pre">S</span></code> is called primitive if
<code class="docutils literal notranslate"><span class="pre">S</span></code> contains no nontrivial block under the action of <code class="docutils literal notranslate"><span class="pre">G</span></code>
(a block is nontrivial if its cardinality is more than <code class="docutils literal notranslate"><span class="pre">1</span></code>).</p>
<p class="rubric">Notes</p>
<p>The algorithm is described in [1], p.83, and uses the function
minimal_block to search for blocks of the form <span class="math notranslate nohighlight">\(\{0, k\}\)</span> for <code class="docutils literal notranslate"><span class="pre">k</span></code>
ranging over representatives for the orbits of <span class="math notranslate nohighlight">\(G_0\)</span>, the stabilizer of
<code class="docutils literal notranslate"><span class="pre">0</span></code>. This algorithm has complexity <span class="math notranslate nohighlight">\(O(n^2)\)</span> where <code class="docutils literal notranslate"><span class="pre">n</span></code> is the degree
of the group, and will perform badly if <span class="math notranslate nohighlight">\(G_0\)</span> is small.</p>
<p>There are two implementations offered: one finds <span class="math notranslate nohighlight">\(G_0\)</span>
deterministically using the function <code class="docutils literal notranslate"><span class="pre">stabilizer</span></code>, and the other
(default) produces random elements of <span class="math notranslate nohighlight">\(G_0\)</span> using <code class="docutils literal notranslate"><span class="pre">random_stab</span></code>,
hoping that they generate a subgroup of <span class="math notranslate nohighlight">\(G_0\)</span> with not too many more
orbits than <span class="math notranslate nohighlight">\(G_0\)</span> (this is suggested in [1], p.83). Behavior is changed
by the <code class="docutils literal notranslate"><span class="pre">randomized</span></code> flag.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="n">DihedralGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">D</span> <span class="o">=</span> <span class="n">DihedralGroup</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">D</span><span class="o">.</span><span class="n">is_primitive</span><span class="p">()</span>
<span class="go">False</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.minimal_block" title="sympy.combinatorics.perm_groups.PermutationGroup.minimal_block"><code class="xref py py-obj docutils literal notranslate"><span class="pre">minimal_block</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.random_stab" title="sympy.combinatorics.perm_groups.PermutationGroup.random_stab"><code class="xref py py-obj docutils literal notranslate"><span class="pre">random_stab</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.is_solvable">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">is_solvable</span></span><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.is_solvable" title="Permalink to this definition">¶</a></dt>
<dd><p>Test if the group is solvable.</p>
<p><code class="docutils literal notranslate"><span class="pre">G</span></code> is solvable if its derived series terminates with the trivial
group ([1], p.29).</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="n">SymmetricGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S</span> <span class="o">=</span> <span class="n">SymmetricGroup</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S</span><span class="o">.</span><span class="n">is_solvable</span>
<span class="go">True</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.is_nilpotent" title="sympy.combinatorics.perm_groups.PermutationGroup.is_nilpotent"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_nilpotent</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.derived_series" title="sympy.combinatorics.perm_groups.PermutationGroup.derived_series"><code class="xref py py-obj docutils literal notranslate"><span class="pre">derived_series</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.is_subgroup">
<span class="sig-name descname"><span class="pre">is_subgroup</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">G</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">strict</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L2333-L2392"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.is_subgroup" title="Permalink to this definition">¶</a></dt>
<dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if all elements of <code class="docutils literal notranslate"><span class="pre">self</span></code> belong to <code class="docutils literal notranslate"><span class="pre">G</span></code>.</p>
<p>If <code class="docutils literal notranslate"><span class="pre">strict</span></code> is <code class="docutils literal notranslate"><span class="pre">False</span></code> then if <code class="docutils literal notranslate"><span class="pre">self</span></code>’s degree is smaller
than <code class="docutils literal notranslate"><span class="pre">G</span></code>’s, the elements will be resized to have the same degree.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">Permutation</span><span class="p">,</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="p">(</span><span class="n">SymmetricGroup</span><span class="p">,</span>
<span class="gp">... </span>   <span class="n">CyclicGroup</span><span class="p">)</span>
</pre></div>
</div>
<p>Testing is strict by default: the degree of each group must be the
same:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G1</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">Permutation</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="n">Permutation</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G2</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">Permutation</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="n">Permutation</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">)])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G3</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">p</span><span class="p">,</span> <span class="n">p</span><span class="o">**</span><span class="mi">2</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">assert</span> <span class="n">G1</span><span class="o">.</span><span class="n">order</span><span class="p">()</span> <span class="o">==</span> <span class="n">G2</span><span class="o">.</span><span class="n">order</span><span class="p">()</span> <span class="o">==</span> <span class="n">G3</span><span class="o">.</span><span class="n">order</span><span class="p">()</span> <span class="o">==</span> <span class="mi">6</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G1</span><span class="o">.</span><span class="n">is_subgroup</span><span class="p">(</span><span class="n">G2</span><span class="p">)</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G1</span><span class="o">.</span><span class="n">is_subgroup</span><span class="p">(</span><span class="n">G3</span><span class="p">)</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G3</span><span class="o">.</span><span class="n">is_subgroup</span><span class="p">(</span><span class="n">PermutationGroup</span><span class="p">(</span><span class="n">G3</span><span class="p">[</span><span class="mi">1</span><span class="p">]))</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G3</span><span class="o">.</span><span class="n">is_subgroup</span><span class="p">(</span><span class="n">PermutationGroup</span><span class="p">(</span><span class="n">G3</span><span class="p">[</span><span class="mi">0</span><span class="p">]))</span>
<span class="go">True</span>
</pre></div>
</div>
<p>To ignore the size, set <code class="docutils literal notranslate"><span class="pre">strict</span></code> to <code class="docutils literal notranslate"><span class="pre">False</span></code>:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">S3</span> <span class="o">=</span> <span class="n">SymmetricGroup</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S5</span> <span class="o">=</span> <span class="n">SymmetricGroup</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S3</span><span class="o">.</span><span class="n">is_subgroup</span><span class="p">(</span><span class="n">S5</span><span class="p">,</span> <span class="n">strict</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">C7</span> <span class="o">=</span> <span class="n">CyclicGroup</span><span class="p">(</span><span class="mi">7</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">S5</span><span class="o">*</span><span class="n">C7</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S5</span><span class="o">.</span><span class="n">is_subgroup</span><span class="p">(</span><span class="n">G</span><span class="p">,</span> <span class="kc">False</span><span class="p">)</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">C7</span><span class="o">.</span><span class="n">is_subgroup</span><span class="p">(</span><span class="n">G</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
<span class="go">False</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.is_symmetric">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">is_symmetric</span></span><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.is_symmetric" title="Permalink to this definition">¶</a></dt>
<dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if the group is symmetric.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="n">SymmetricGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">g</span> <span class="o">=</span> <span class="n">SymmetricGroup</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">g</span><span class="o">.</span><span class="n">is_symmetric</span>
<span class="go">True</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">Permutation</span><span class="p">,</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">g</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">(</span>
<span class="gp">... </span>    <span class="n">Permutation</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">),</span>
<span class="gp">... </span>    <span class="n">Permutation</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">g</span><span class="o">.</span><span class="n">is_symmetric</span>
<span class="go">True</span>
</pre></div>
</div>
<p class="rubric">Notes</p>
<p>This uses a naive test involving the computation of the full
group order.
If you need more quicker taxonomy for large groups, you can use
<a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.is_alt_sym" title="sympy.combinatorics.perm_groups.PermutationGroup.is_alt_sym"><code class="xref py py-meth docutils literal notranslate"><span class="pre">PermutationGroup.is_alt_sym()</span></code></a>.
However, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.is_alt_sym" title="sympy.combinatorics.perm_groups.PermutationGroup.is_alt_sym"><code class="xref py py-meth docutils literal notranslate"><span class="pre">PermutationGroup.is_alt_sym()</span></code></a> may not be accurate
and is not able to distinguish between an alternating group and
a symmetric group.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.is_alt_sym" title="sympy.combinatorics.perm_groups.PermutationGroup.is_alt_sym"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_alt_sym</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.is_transitive">
<span class="sig-name descname"><span class="pre">is_transitive</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">strict</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L2413-L2463"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.is_transitive" title="Permalink to this definition">¶</a></dt>
<dd><p>Test if the group is transitive.</p>
<p class="rubric">Explanation</p>
<p>A group is transitive if it has a single orbit.</p>
<p>If <code class="docutils literal notranslate"><span class="pre">strict</span></code> is <code class="docutils literal notranslate"><span class="pre">False</span></code> the group is transitive if it has
a single orbit of length different from 1.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.permutations</span> <span class="kn">import</span> <span class="n">Permutation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.perm_groups</span> <span class="kn">import</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G1</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G1</span><span class="o">.</span><span class="n">is_transitive</span><span class="p">()</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G1</span><span class="o">.</span><span class="n">is_transitive</span><span class="p">(</span><span class="n">strict</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">c</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G2</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">a</span><span class="p">,</span> <span class="n">c</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G2</span><span class="o">.</span><span class="n">is_transitive</span><span class="p">()</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">d</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">e</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G3</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">d</span><span class="p">,</span> <span class="n">e</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G3</span><span class="o">.</span><span class="n">is_transitive</span><span class="p">()</span> <span class="ow">or</span> <span class="n">G3</span><span class="o">.</span><span class="n">is_transitive</span><span class="p">(</span><span class="n">strict</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="go">False</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.is_trivial">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">is_trivial</span></span><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.is_trivial" title="Permalink to this definition">¶</a></dt>
<dd><p>Test if the group is the trivial group.</p>
<p>This is true if the group contains only the identity permutation.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">Permutation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.perm_groups</span> <span class="kn">import</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">Permutation</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">])])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">is_trivial</span>
<span class="go">True</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.lower_central_series">
<span class="sig-name descname"><span class="pre">lower_central_series</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L2485-L2522"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.lower_central_series" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the lower central series for the group.</p>
<p>The lower central series for a group <span class="math notranslate nohighlight">\(G\)</span> is the series
<span class="math notranslate nohighlight">\(G = G_0 &gt; G_1 &gt; G_2 &gt; \ldots\)</span> where
<span class="math notranslate nohighlight">\(G_k = [G, G_{k-1}]\)</span>, i.e. every term after the first is equal to the
commutator of <span class="math notranslate nohighlight">\(G\)</span> and the previous term in <span class="math notranslate nohighlight">\(G1\)</span> ([1], p.29).</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A list of permutation groups in the order <span class="math notranslate nohighlight">\(G = G_0, G_1, G_2, \ldots\)</span></p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="p">(</span><span class="n">AlternatingGroup</span><span class="p">,</span>
<span class="gp">... </span><span class="n">DihedralGroup</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">A</span> <span class="o">=</span> <span class="n">AlternatingGroup</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">len</span><span class="p">(</span><span class="n">A</span><span class="o">.</span><span class="n">lower_central_series</span><span class="p">())</span>
<span class="go">2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">A</span><span class="o">.</span><span class="n">lower_central_series</span><span class="p">()[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">is_subgroup</span><span class="p">(</span><span class="n">DihedralGroup</span><span class="p">(</span><span class="mi">2</span><span class="p">))</span>
<span class="go">True</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.commutator" title="sympy.combinatorics.perm_groups.PermutationGroup.commutator"><code class="xref py py-obj docutils literal notranslate"><span class="pre">commutator</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.derived_series" title="sympy.combinatorics.perm_groups.PermutationGroup.derived_series"><code class="xref py py-obj docutils literal notranslate"><span class="pre">derived_series</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.make_perm">
<span class="sig-name descname"><span class="pre">make_perm</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">n</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">seed</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L3316-L3366"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.make_perm" title="Permalink to this definition">¶</a></dt>
<dd><p>Multiply <code class="docutils literal notranslate"><span class="pre">n</span></code> randomly selected permutations from
pgroup together, starting with the identity
permutation. If <code class="docutils literal notranslate"><span class="pre">n</span></code> is a list of integers, those
integers will be used to select the permutations and they
will be applied in L to R order: make_perm((A, B, C)) will
give CBA(I) where I is the identity permutation.</p>
<p><code class="docutils literal notranslate"><span class="pre">seed</span></code> is used to set the seed for the random selection
of permutations from pgroup. If this is a list of integers,
the corresponding permutations from pgroup will be selected
in the order give. This is mainly used for testing purposes.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">Permutation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.perm_groups</span> <span class="kn">import</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="o">=</span> <span class="p">[</span><span class="n">Permutation</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">2</span><span class="p">]),</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">])]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">make_perm</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">])</span>
<span class="go">(0 1)(2 3)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">make_perm</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">])</span>
<span class="go">(0 2 3 1)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">make_perm</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">])</span>
<span class="go">(0 2 3 1)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.random" title="sympy.combinatorics.perm_groups.PermutationGroup.random"><code class="xref py py-obj docutils literal notranslate"><span class="pre">random</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.max_div">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">max_div</span></span><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.max_div" title="Permalink to this definition">¶</a></dt>
<dd><p>Maximum proper divisor of the degree of a permutation group.</p>
<p class="rubric">Explanation</p>
<p>Obviously, this is the degree divided by its minimal proper divisor
(larger than <code class="docutils literal notranslate"><span class="pre">1</span></code>, if one exists). As it is guaranteed to be prime,
the <code class="docutils literal notranslate"><span class="pre">sieve</span></code> from <code class="docutils literal notranslate"><span class="pre">sympy.ntheory</span></code> is used.
This function is also used as an optimization tool for the functions
<code class="docutils literal notranslate"><span class="pre">minimal_block</span></code> and <code class="docutils literal notranslate"><span class="pre">_union_find_merge</span></code>.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">Permutation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.perm_groups</span> <span class="kn">import</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">Permutation</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">])])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">max_div</span>
<span class="go">2</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.minimal_block" title="sympy.combinatorics.perm_groups.PermutationGroup.minimal_block"><code class="xref py py-obj docutils literal notranslate"><span class="pre">minimal_block</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup._union_find_merge" title="sympy.combinatorics.perm_groups.PermutationGroup._union_find_merge"><code class="xref py py-obj docutils literal notranslate"><span class="pre">_union_find_merge</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.minimal_block">
<span class="sig-name descname"><span class="pre">minimal_block</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">points</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L2563-L2650"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.minimal_block" title="Permalink to this definition">¶</a></dt>
<dd><p>For a transitive group, finds the block system generated by
<code class="docutils literal notranslate"><span class="pre">points</span></code>.</p>
<p class="rubric">Explanation</p>
<p>If a group <code class="docutils literal notranslate"><span class="pre">G</span></code> acts on a set <code class="docutils literal notranslate"><span class="pre">S</span></code>, a nonempty subset <code class="docutils literal notranslate"><span class="pre">B</span></code> of <code class="docutils literal notranslate"><span class="pre">S</span></code>
is called a block under the action of <code class="docutils literal notranslate"><span class="pre">G</span></code> if for all <code class="docutils literal notranslate"><span class="pre">g</span></code> in <code class="docutils literal notranslate"><span class="pre">G</span></code>
we have <code class="docutils literal notranslate"><span class="pre">gB</span> <span class="pre">=</span> <span class="pre">B</span></code> (<code class="docutils literal notranslate"><span class="pre">g</span></code> fixes <code class="docutils literal notranslate"><span class="pre">B</span></code>) or <code class="docutils literal notranslate"><span class="pre">gB</span></code> and <code class="docutils literal notranslate"><span class="pre">B</span></code> have no
common points (<code class="docutils literal notranslate"><span class="pre">g</span></code> moves <code class="docutils literal notranslate"><span class="pre">B</span></code> entirely). ([1], p.23; [6]).</p>
<p>The distinct translates <code class="docutils literal notranslate"><span class="pre">gB</span></code> of a block <code class="docutils literal notranslate"><span class="pre">B</span></code> for <code class="docutils literal notranslate"><span class="pre">g</span></code> in <code class="docutils literal notranslate"><span class="pre">G</span></code>
partition the set <code class="docutils literal notranslate"><span class="pre">S</span></code> and this set of translates is known as a block
system. Moreover, we obviously have that all blocks in the partition
have the same size, hence the block size divides <code class="docutils literal notranslate"><span class="pre">|S|</span></code> ([1], p.23).
A <code class="docutils literal notranslate"><span class="pre">G</span></code>-congruence is an equivalence relation <code class="docutils literal notranslate"><span class="pre">~</span></code> on the set <code class="docutils literal notranslate"><span class="pre">S</span></code>
such that <code class="docutils literal notranslate"><span class="pre">a</span> <span class="pre">~</span> <span class="pre">b</span></code> implies <code class="docutils literal notranslate"><span class="pre">g(a)</span> <span class="pre">~</span> <span class="pre">g(b)</span></code> for all <code class="docutils literal notranslate"><span class="pre">g</span></code> in <code class="docutils literal notranslate"><span class="pre">G</span></code>.
For a transitive group, the equivalence classes of a <code class="docutils literal notranslate"><span class="pre">G</span></code>-congruence
and the blocks of a block system are the same thing ([1], p.23).</p>
<p>The algorithm below checks the group for transitivity, and then finds
the <code class="docutils literal notranslate"><span class="pre">G</span></code>-congruence generated by the pairs <code class="docutils literal notranslate"><span class="pre">(p_0,</span> <span class="pre">p_1),</span> <span class="pre">(p_0,</span> <span class="pre">p_2),</span>
<span class="pre">...,</span> <span class="pre">(p_0,p_{k-1})</span></code> which is the same as finding the maximal block
system (i.e., the one with minimum block size) such that
<code class="docutils literal notranslate"><span class="pre">p_0,</span> <span class="pre">...,</span> <span class="pre">p_{k-1}</span></code> are in the same block ([1], p.83).</p>
<p>It is an implementation of Atkinson’s algorithm, as suggested in [1],
and manipulates an equivalence relation on the set <code class="docutils literal notranslate"><span class="pre">S</span></code> using a
union-find data structure. The running time is just above
<span class="math notranslate nohighlight">\(O(|points||S|)\)</span>. ([1], pp. 83-87; [7]).</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="n">DihedralGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">D</span> <span class="o">=</span> <span class="n">DihedralGroup</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">D</span><span class="o">.</span><span class="n">minimal_block</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">5</span><span class="p">])</span>
<span class="go">[0, 1, 2, 3, 4, 0, 1, 2, 3, 4]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">D</span><span class="o">.</span><span class="n">minimal_block</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">])</span>
<span class="go">[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup._union_find_rep" title="sympy.combinatorics.perm_groups.PermutationGroup._union_find_rep"><code class="xref py py-obj docutils literal notranslate"><span class="pre">_union_find_rep</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup._union_find_merge" title="sympy.combinatorics.perm_groups.PermutationGroup._union_find_merge"><code class="xref py py-obj docutils literal notranslate"><span class="pre">_union_find_merge</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.is_transitive" title="sympy.combinatorics.perm_groups.PermutationGroup.is_transitive"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_transitive</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.is_primitive" title="sympy.combinatorics.perm_groups.PermutationGroup.is_primitive"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_primitive</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.minimal_blocks">
<span class="sig-name descname"><span class="pre">minimal_blocks</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">randomized</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L2211-L2293"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.minimal_blocks" title="Permalink to this definition">¶</a></dt>
<dd><p>For a transitive group, return the list of all minimal
block systems. If a group is intransitive, return <span class="math notranslate nohighlight">\(False\)</span>.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">Permutation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.perm_groups</span> <span class="kn">import</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="n">DihedralGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">DihedralGroup</span><span class="p">(</span><span class="mi">6</span><span class="p">)</span><span class="o">.</span><span class="n">minimal_blocks</span><span class="p">()</span>
<span class="go">[[0, 1, 0, 1, 0, 1], [0, 1, 2, 0, 1, 2]]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">(</span><span class="n">Permutation</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">5</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">minimal_blocks</span><span class="p">()</span>
<span class="go">False</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.minimal_block" title="sympy.combinatorics.perm_groups.PermutationGroup.minimal_block"><code class="xref py py-obj docutils literal notranslate"><span class="pre">minimal_block</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.is_transitive" title="sympy.combinatorics.perm_groups.PermutationGroup.is_transitive"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_transitive</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.is_primitive" title="sympy.combinatorics.perm_groups.PermutationGroup.is_primitive"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_primitive</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.normal_closure">
<span class="sig-name descname"><span class="pre">normal_closure</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">other</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">k</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">10</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L2744-L2843"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.normal_closure" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the normal closure of a subgroup/set of permutations.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>other</strong></p>
<blockquote>
<div><p>a subgroup/list of permutations/single permutation</p>
</div></blockquote>
<p><strong>k</strong></p>
<blockquote>
<div><p>an implementation-specific parameter that determines the number
of conjugates that are adjoined to <code class="docutils literal notranslate"><span class="pre">other</span></code> at once</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Explanation</p>
<p>If <code class="docutils literal notranslate"><span class="pre">S</span></code> is a subset of a group <code class="docutils literal notranslate"><span class="pre">G</span></code>, the normal closure of <code class="docutils literal notranslate"><span class="pre">A</span></code> in <code class="docutils literal notranslate"><span class="pre">G</span></code>
is defined as the intersection of all normal subgroups of <code class="docutils literal notranslate"><span class="pre">G</span></code> that
contain <code class="docutils literal notranslate"><span class="pre">A</span></code> ([1], p.14). Alternatively, it is the group generated by
the conjugates <code class="docutils literal notranslate"><span class="pre">x^{-1}yx</span></code> for <code class="docutils literal notranslate"><span class="pre">x</span></code> a generator of <code class="docutils literal notranslate"><span class="pre">G</span></code> and <code class="docutils literal notranslate"><span class="pre">y</span></code> a
generator of the subgroup <code class="docutils literal notranslate"><span class="pre">\left\langle</span> <span class="pre">S\right\rangle</span></code> generated by
<code class="docutils literal notranslate"><span class="pre">S</span></code> (for some chosen generating set for <code class="docutils literal notranslate"><span class="pre">\left\langle</span> <span class="pre">S\right\rangle</span></code>)
([1], p.73).</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="p">(</span><span class="n">SymmetricGroup</span><span class="p">,</span>
<span class="gp">... </span><span class="n">CyclicGroup</span><span class="p">,</span> <span class="n">AlternatingGroup</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S</span> <span class="o">=</span> <span class="n">SymmetricGroup</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">C</span> <span class="o">=</span> <span class="n">CyclicGroup</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">S</span><span class="o">.</span><span class="n">normal_closure</span><span class="p">(</span><span class="n">C</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">order</span><span class="p">()</span>
<span class="go">60</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">is_subgroup</span><span class="p">(</span><span class="n">AlternatingGroup</span><span class="p">(</span><span class="mi">5</span><span class="p">))</span>
<span class="go">True</span>
</pre></div>
</div>
<p class="rubric">Notes</p>
<p>The algorithm is described in [1], pp. 73-74; it makes use of the
generation of random elements for permutation groups by the product
replacement algorithm.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.commutator" title="sympy.combinatorics.perm_groups.PermutationGroup.commutator"><code class="xref py py-obj docutils literal notranslate"><span class="pre">commutator</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.derived_subgroup" title="sympy.combinatorics.perm_groups.PermutationGroup.derived_subgroup"><code class="xref py py-obj docutils literal notranslate"><span class="pre">derived_subgroup</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.random_pr" title="sympy.combinatorics.perm_groups.PermutationGroup.random_pr"><code class="xref py py-obj docutils literal notranslate"><span class="pre">random_pr</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.orbit">
<span class="sig-name descname"><span class="pre">orbit</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">alpha</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">action</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'tuples'</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L2845-L2882"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.orbit" title="Permalink to this definition">¶</a></dt>
<dd><p>Compute the orbit of alpha <span class="math notranslate nohighlight">\(\{g(\alpha) | g \in G\}\)</span> as a set.</p>
<p class="rubric">Explanation</p>
<p>The time complexity of the algorithm used here is <span class="math notranslate nohighlight">\(O(|Orb|*r)\)</span> where
<span class="math notranslate nohighlight">\(|Orb|\)</span> is the size of the orbit and <code class="docutils literal notranslate"><span class="pre">r</span></code> is the number of generators of
the group. For a more detailed analysis, see [1], p.78, [2], pp. 19-21.
Here alpha can be a single point, or a list of points.</p>
<p>If alpha is a single point, the ordinary orbit is computed.
if alpha is a list of points, there are three available options:</p>
<p>‘union’ - computes the union of the orbits of the points in the list
‘tuples’ - computes the orbit of the list interpreted as an ordered
tuple under the group action ( i.e., g((1,2,3)) = (g(1), g(2), g(3)) )
‘sets’ - computes the orbit of the list interpreted as a sets</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics</span> <span class="kn">import</span> <span class="n">Permutation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.perm_groups</span> <span class="kn">import</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">3</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">a</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">orbit</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
<span class="go">{0, 1, 2}</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">orbit</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">4</span><span class="p">],</span> <span class="s1">&#39;union&#39;</span><span class="p">)</span>
<span class="go">{0, 1, 2, 3, 4, 5, 6}</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.orbit_transversal" title="sympy.combinatorics.perm_groups.PermutationGroup.orbit_transversal"><code class="xref py py-obj docutils literal notranslate"><span class="pre">orbit_transversal</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.orbit_rep">
<span class="sig-name descname"><span class="pre">orbit_rep</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">alpha</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">beta</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">schreier_vector</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L2884-L2922"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.orbit_rep" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a group element which sends <code class="docutils literal notranslate"><span class="pre">alpha</span></code> to <code class="docutils literal notranslate"><span class="pre">beta</span></code>.</p>
<p class="rubric">Explanation</p>
<p>If <code class="docutils literal notranslate"><span class="pre">beta</span></code> is not in the orbit of <code class="docutils literal notranslate"><span class="pre">alpha</span></code>, the function returns
<code class="docutils literal notranslate"><span class="pre">False</span></code>. This implementation makes use of the schreier vector.
For a proof of correctness, see [1], p.80</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="n">AlternatingGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">AlternatingGroup</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">orbit_rep</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="go">(0 4 1 2 3)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.schreier_vector" title="sympy.combinatorics.perm_groups.PermutationGroup.schreier_vector"><code class="xref py py-obj docutils literal notranslate"><span class="pre">schreier_vector</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.orbit_transversal">
<span class="sig-name descname"><span class="pre">orbit_transversal</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">alpha</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pairs</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L2924-L2951"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.orbit_transversal" title="Permalink to this definition">¶</a></dt>
<dd><p>Computes a transversal for the orbit of <code class="docutils literal notranslate"><span class="pre">alpha</span></code> as a set.</p>
<p class="rubric">Explanation</p>
<p>For a permutation group <span class="math notranslate nohighlight">\(G\)</span>, a transversal for the orbit
<span class="math notranslate nohighlight">\(Orb = \{g(\alpha) | g \in G\}\)</span> is a set
<span class="math notranslate nohighlight">\(\{g_\beta | g_\beta(\alpha) = \beta\}\)</span> for <span class="math notranslate nohighlight">\(\beta \in Orb\)</span>.
Note that there may be more than one possible transversal.
If <code class="docutils literal notranslate"><span class="pre">pairs</span></code> is set to <code class="docutils literal notranslate"><span class="pre">True</span></code>, it returns the list of pairs
<span class="math notranslate nohighlight">\((\beta, g_\beta)\)</span>. For a proof of correctness, see [1], p.79</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="n">DihedralGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">DihedralGroup</span><span class="p">(</span><span class="mi">6</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">orbit_transversal</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
<span class="go">[(5), (0 1 2 3 4 5), (0 5)(1 4)(2 3), (0 2 4)(1 3 5), (5)(0 4)(1 3), (0 3)(1 4)(2 5)]</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.orbit" title="sympy.combinatorics.perm_groups.PermutationGroup.orbit"><code class="xref py py-obj docutils literal notranslate"><span class="pre">orbit</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.orbits">
<span class="sig-name descname"><span class="pre">orbits</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rep</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L2953-L2968"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.orbits" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the orbits of <code class="docutils literal notranslate"><span class="pre">self</span></code>, ordered according to lowest element
in each orbit.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.permutations</span> <span class="kn">import</span> <span class="n">Permutation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.perm_groups</span> <span class="kn">import</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">5</span><span class="p">)(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)(</span><span class="mi">4</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">6</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">5</span><span class="p">)(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">)(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">orbits</span><span class="p">()</span>
<span class="go">[{0, 2, 3, 4, 6}, {1, 5}]</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.order">
<span class="sig-name descname"><span class="pre">order</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L2970-L3023"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.order" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the order of the group: the number of permutations that
can be generated from elements of the group.</p>
<p>The number of permutations comprising the group is given by
<code class="docutils literal notranslate"><span class="pre">len(group)</span></code>; the length of each permutation in the group is
given by <code class="docutils literal notranslate"><span class="pre">group.size</span></code>.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.permutations</span> <span class="kn">import</span> <span class="n">Permutation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.perm_groups</span> <span class="kn">import</span> <span class="n">PermutationGroup</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">a</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">degree</span>
<span class="go">3</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">len</span><span class="p">(</span><span class="n">G</span><span class="p">)</span>
<span class="go">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">order</span><span class="p">()</span>
<span class="go">2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">list</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="n">generate</span><span class="p">())</span>
<span class="go">[(2), (2)(0 1)]</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">order</span><span class="p">()</span>
<span class="go">6</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.degree" title="sympy.combinatorics.perm_groups.PermutationGroup.degree"><code class="xref py py-obj docutils literal notranslate"><span class="pre">degree</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.pointwise_stabilizer">
<span class="sig-name descname"><span class="pre">pointwise_stabilizer</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">points</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">incremental</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L3263-L3314"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.pointwise_stabilizer" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the pointwise stabilizer for a set of points.</p>
<p class="rubric">Explanation</p>
<p>For a permutation group <span class="math notranslate nohighlight">\(G\)</span> and a set of points
<span class="math notranslate nohighlight">\(\{p_1, p_2,\ldots, p_k\}\)</span>, the pointwise stabilizer of
<span class="math notranslate nohighlight">\(p_1, p_2, \ldots, p_k\)</span> is defined as
<span class="math notranslate nohighlight">\(G_{p_1,\ldots, p_k} =
\{g\in G | g(p_i) = p_i \forall i\in\{1, 2,\ldots,k\}\}\)</span> ([1],p20).
It is a subgroup of <span class="math notranslate nohighlight">\(G\)</span>.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="n">SymmetricGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S</span> <span class="o">=</span> <span class="n">SymmetricGroup</span><span class="p">(</span><span class="mi">7</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Stab</span> <span class="o">=</span> <span class="n">S</span><span class="o">.</span><span class="n">pointwise_stabilizer</span><span class="p">([</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">5</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Stab</span><span class="o">.</span><span class="n">is_subgroup</span><span class="p">(</span><span class="n">S</span><span class="o">.</span><span class="n">stabilizer</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">stabilizer</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span><span class="o">.</span><span class="n">stabilizer</span><span class="p">(</span><span class="mi">5</span><span class="p">))</span>
<span class="go">True</span>
</pre></div>
</div>
<p class="rubric">Notes</p>
<p>When incremental == True,
rather than the obvious implementation using successive calls to
<code class="docutils literal notranslate"><span class="pre">.stabilizer()</span></code>, this uses the incremental Schreier-Sims algorithm
to obtain a base with starting segment - the given points.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.stabilizer" title="sympy.combinatorics.perm_groups.PermutationGroup.stabilizer"><code class="xref py py-obj docutils literal notranslate"><span class="pre">stabilizer</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.schreier_sims_incremental" title="sympy.combinatorics.perm_groups.PermutationGroup.schreier_sims_incremental"><code class="xref py py-obj docutils literal notranslate"><span class="pre">schreier_sims_incremental</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.polycyclic_group">
<span class="sig-name descname"><span class="pre">polycyclic_group</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L4946-L4988"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.polycyclic_group" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the PolycyclicGroup instance with below parameters:</p>
<p class="rubric">Explanation</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">pc_sequence</span></code> : Polycyclic sequence is formed by collecting all
the missing generators between the adjacent groups in the
derived series of given permutation group.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">pc_series</span></code> : Polycyclic series is formed by adding all the missing
generators of <code class="docutils literal notranslate"><span class="pre">der[i+1]</span></code> in <code class="docutils literal notranslate"><span class="pre">der[i]</span></code>, where <code class="docutils literal notranslate"><span class="pre">der</span></code> represents
the derived series.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">relative_order</span></code> : A list, computed by the ratio of adjacent groups in
pc_series.</p></li>
</ul>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.presentation">
<span class="sig-name descname"><span class="pre">presentation</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">eliminate_gens</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L4831-L4944"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.presentation" title="Permalink to this definition">¶</a></dt>
<dd><p>Return an <span class="math notranslate nohighlight">\(FpGroup\)</span> presentation of the group.</p>
<p>The algorithm is described in [1], Chapter 6.1.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.random">
<span class="sig-name descname"><span class="pre">random</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">af</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L3368-L3372"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.random" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a random group element</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.random_pr">
<span class="sig-name descname"><span class="pre">random_pr</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">gen_count</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">11</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">iterations</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">50</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">_random_prec</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L3374-L3418"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.random_pr" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a random group element using product replacement.</p>
<p class="rubric">Explanation</p>
<p>For the details of the product replacement algorithm, see
<code class="docutils literal notranslate"><span class="pre">_random_pr_init</span></code> In <code class="docutils literal notranslate"><span class="pre">random_pr</span></code> the actual ‘product replacement’
is performed. Notice that if the attribute <code class="docutils literal notranslate"><span class="pre">_random_gens</span></code>
is empty, it needs to be initialized by <code class="docutils literal notranslate"><span class="pre">_random_pr_init</span></code>.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup._random_pr_init" title="sympy.combinatorics.perm_groups.PermutationGroup._random_pr_init"><code class="xref py py-obj docutils literal notranslate"><span class="pre">_random_pr_init</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.random_stab">
<span class="sig-name descname"><span class="pre">random_stab</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">alpha</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">schreier_vector</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">_random_prec</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L3420-L3440"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.random_stab" title="Permalink to this definition">¶</a></dt>
<dd><p>Random element from the stabilizer of <code class="docutils literal notranslate"><span class="pre">alpha</span></code>.</p>
<p>The schreier vector for <code class="docutils literal notranslate"><span class="pre">alpha</span></code> is an optional argument used
for speeding up repeated calls. The algorithm is described in [1], p.81</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.random_pr" title="sympy.combinatorics.perm_groups.PermutationGroup.random_pr"><code class="xref py py-obj docutils literal notranslate"><span class="pre">random_pr</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.orbit_rep" title="sympy.combinatorics.perm_groups.PermutationGroup.orbit_rep"><code class="xref py py-obj docutils literal notranslate"><span class="pre">orbit_rep</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.schreier_sims">
<span class="sig-name descname"><span class="pre">schreier_sims</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L3442-L3473"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.schreier_sims" title="Permalink to this definition">¶</a></dt>
<dd><p>Schreier-Sims algorithm.</p>
<p class="rubric">Explanation</p>
<p>It computes the generators of the chain of stabilizers
<span class="math notranslate nohighlight">\(G &gt; G_{b_1} &gt; .. &gt; G_{b1,..,b_r} &gt; 1\)</span>
in which <span class="math notranslate nohighlight">\(G_{b_1,..,b_i}\)</span> stabilizes <span class="math notranslate nohighlight">\(b_1,..,b_i\)</span>,
and the corresponding <code class="docutils literal notranslate"><span class="pre">s</span></code> cosets.
An element of the group can be written as the product
<span class="math notranslate nohighlight">\(h_1*..*h_s\)</span>.</p>
<p>We use the incremental Schreier-Sims algorithm.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.permutations</span> <span class="kn">import</span> <span class="n">Permutation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.perm_groups</span> <span class="kn">import</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">schreier_sims</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">basic_transversals</span>
<span class="go">[{0: (2)(0 1), 1: (2), 2: (1 2)},</span>
<span class="go"> {0: (2), 2: (0 2)}]</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.schreier_sims_incremental">
<span class="sig-name descname"><span class="pre">schreier_sims_incremental</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">base</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">gens</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">slp_dict</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L3500-L3683"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.schreier_sims_incremental" title="Permalink to this definition">¶</a></dt>
<dd><p>Extend a sequence of points and generating set to a base and strong
generating set.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>base</strong></p>
<blockquote>
<div><p>The sequence of points to be extended to a base. Optional
parameter with default value <code class="docutils literal notranslate"><span class="pre">[]</span></code>.</p>
</div></blockquote>
<p><strong>gens</strong></p>
<blockquote>
<div><p>The generating set to be extended to a strong generating set
relative to the base obtained. Optional parameter with default
value <code class="docutils literal notranslate"><span class="pre">self.generators</span></code>.</p>
</div></blockquote>
<p><strong>slp_dict</strong></p>
<blockquote>
<div><p>If <span class="math notranslate nohighlight">\(True\)</span>, return a dictionary <span class="math notranslate nohighlight">\({g: gens}\)</span> for each strong
generator <span class="math notranslate nohighlight">\(g\)</span> where <span class="math notranslate nohighlight">\(gens\)</span> is a list of strong generators
coming before <span class="math notranslate nohighlight">\(g\)</span> in <span class="math notranslate nohighlight">\(strong_gens\)</span>, such that the product
of the elements of <span class="math notranslate nohighlight">\(gens\)</span> is equal to <span class="math notranslate nohighlight">\(g\)</span>.</p>
</div></blockquote>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>(base, strong_gens)</p>
<blockquote>
<div><p><code class="docutils literal notranslate"><span class="pre">base</span></code> is the base obtained, and <code class="docutils literal notranslate"><span class="pre">strong_gens</span></code> is the strong
generating set relative to it. The original parameters <code class="docutils literal notranslate"><span class="pre">base</span></code>,
<code class="docutils literal notranslate"><span class="pre">gens</span></code> remain unchanged.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="n">AlternatingGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.testutil</span> <span class="kn">import</span> <span class="n">_verify_bsgs</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">A</span> <span class="o">=</span> <span class="n">AlternatingGroup</span><span class="p">(</span><span class="mi">7</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">base</span> <span class="o">=</span> <span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">seq</span> <span class="o">=</span> <span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">base</span><span class="p">,</span> <span class="n">strong_gens</span> <span class="o">=</span> <span class="n">A</span><span class="o">.</span><span class="n">schreier_sims_incremental</span><span class="p">(</span><span class="n">base</span><span class="o">=</span><span class="n">seq</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">_verify_bsgs</span><span class="p">(</span><span class="n">A</span><span class="p">,</span> <span class="n">base</span><span class="p">,</span> <span class="n">strong_gens</span><span class="p">)</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">base</span><span class="p">[:</span><span class="mi">2</span><span class="p">]</span>
<span class="go">[2, 3]</span>
</pre></div>
</div>
<p class="rubric">Notes</p>
<p>This version of the Schreier-Sims algorithm runs in polynomial time.
There are certain assumptions in the implementation - if the trivial
group is provided, <code class="docutils literal notranslate"><span class="pre">base</span></code> and <code class="docutils literal notranslate"><span class="pre">gens</span></code> are returned immediately,
as any sequence of points is a base for the trivial group. If the
identity is present in the generators <code class="docutils literal notranslate"><span class="pre">gens</span></code>, it is removed as
it is a redundant generator.
The implementation is described in [1], pp. 90-93.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.schreier_sims" title="sympy.combinatorics.perm_groups.PermutationGroup.schreier_sims"><code class="xref py py-obj docutils literal notranslate"><span class="pre">schreier_sims</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.schreier_sims_random" title="sympy.combinatorics.perm_groups.PermutationGroup.schreier_sims_random"><code class="xref py py-obj docutils literal notranslate"><span class="pre">schreier_sims_random</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.schreier_sims_random">
<span class="sig-name descname"><span class="pre">schreier_sims_random</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">base</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">gens</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">consec_succ</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">10</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">_random_prec</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L3685-L3815"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.schreier_sims_random" title="Permalink to this definition">¶</a></dt>
<dd><p>Randomized Schreier-Sims algorithm.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>base</strong></p>
<blockquote>
<div><p>The sequence to be extended to a base.</p>
</div></blockquote>
<p><strong>gens</strong></p>
<blockquote>
<div><p>The generating set to be extended to a strong generating set.</p>
</div></blockquote>
<p><strong>consec_succ</strong></p>
<blockquote>
<div><p>The parameter defining the probability of a wrong answer.</p>
</div></blockquote>
<p><strong>_random_prec</strong></p>
<blockquote>
<div><p>An internal parameter used for testing purposes.</p>
</div></blockquote>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>(base, strong_gens)</p>
<blockquote>
<div><p><code class="docutils literal notranslate"><span class="pre">base</span></code> is the base and <code class="docutils literal notranslate"><span class="pre">strong_gens</span></code> is the strong generating
set relative to it.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Explanation</p>
<p>The randomized Schreier-Sims algorithm takes the sequence <code class="docutils literal notranslate"><span class="pre">base</span></code>
and the generating set <code class="docutils literal notranslate"><span class="pre">gens</span></code>, and extends <code class="docutils literal notranslate"><span class="pre">base</span></code> to a base, and
<code class="docutils literal notranslate"><span class="pre">gens</span></code> to a strong generating set relative to that base with
probability of a wrong answer at most <span class="math notranslate nohighlight">\(2^{-consec\_succ}\)</span>,
provided the random generators are sufficiently random.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.testutil</span> <span class="kn">import</span> <span class="n">_verify_bsgs</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="n">SymmetricGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S</span> <span class="o">=</span> <span class="n">SymmetricGroup</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">base</span><span class="p">,</span> <span class="n">strong_gens</span> <span class="o">=</span> <span class="n">S</span><span class="o">.</span><span class="n">schreier_sims_random</span><span class="p">(</span><span class="n">consec_succ</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">_verify_bsgs</span><span class="p">(</span><span class="n">S</span><span class="p">,</span> <span class="n">base</span><span class="p">,</span> <span class="n">strong_gens</span><span class="p">)</span> 
<span class="go">True</span>
</pre></div>
</div>
<p class="rubric">Notes</p>
<p>The algorithm is described in detail in [1], pp. 97-98. It extends
the orbits <code class="docutils literal notranslate"><span class="pre">orbs</span></code> and the permutation groups <code class="docutils literal notranslate"><span class="pre">stabs</span></code> to
basic orbits and basic stabilizers for the base and strong generating
set produced in the end.
The idea of the extension process
is to “sift” random group elements through the stabilizer chain
and amend the stabilizers/orbits along the way when a sift
is not successful.
The helper function <code class="docutils literal notranslate"><span class="pre">_strip</span></code> is used to attempt
to decompose a random group element according to the current
state of the stabilizer chain and report whether the element was
fully decomposed (successful sift) or not (unsuccessful sift). In
the latter case, the level at which the sift failed is reported and
used to amend <code class="docutils literal notranslate"><span class="pre">stabs</span></code>, <code class="docutils literal notranslate"><span class="pre">base</span></code>, <code class="docutils literal notranslate"><span class="pre">gens</span></code> and <code class="docutils literal notranslate"><span class="pre">orbs</span></code> accordingly.
The halting condition is for <code class="docutils literal notranslate"><span class="pre">consec_succ</span></code> consecutive successful
sifts to pass. This makes sure that the current <code class="docutils literal notranslate"><span class="pre">base</span></code> and <code class="docutils literal notranslate"><span class="pre">gens</span></code>
form a BSGS with probability at least <span class="math notranslate nohighlight">\(1 - 1/\text{consec\_succ}\)</span>.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.schreier_sims" title="sympy.combinatorics.perm_groups.PermutationGroup.schreier_sims"><code class="xref py py-obj docutils literal notranslate"><span class="pre">schreier_sims</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.schreier_vector">
<span class="sig-name descname"><span class="pre">schreier_vector</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">alpha</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L3817-L3865"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.schreier_vector" title="Permalink to this definition">¶</a></dt>
<dd><p>Computes the schreier vector for <code class="docutils literal notranslate"><span class="pre">alpha</span></code>.</p>
<p class="rubric">Explanation</p>
<p>The Schreier vector efficiently stores information
about the orbit of <code class="docutils literal notranslate"><span class="pre">alpha</span></code>. It can later be used to quickly obtain
elements of the group that send <code class="docutils literal notranslate"><span class="pre">alpha</span></code> to a particular element
in the orbit. Notice that the Schreier vector depends on the order
in which the group generators are listed. For a definition, see [3].
Since list indices start from zero, we adopt the convention to use
“None” instead of 0 to signify that an element doesn’t belong
to the orbit.
For the algorithm and its correctness, see [2], pp.78-80.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.perm_groups</span> <span class="kn">import</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.permutations</span> <span class="kn">import</span> <span class="n">Permutation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">2</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">0</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">schreier_vector</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
<span class="go">[-1, None, 0, 1, None, 1, 0]</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.orbit" title="sympy.combinatorics.perm_groups.PermutationGroup.orbit"><code class="xref py py-obj docutils literal notranslate"><span class="pre">orbit</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.stabilizer">
<span class="sig-name descname"><span class="pre">stabilizer</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">alpha</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L3867-L3892"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.stabilizer" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the stabilizer subgroup of <code class="docutils literal notranslate"><span class="pre">alpha</span></code>.</p>
<p class="rubric">Explanation</p>
<p>The stabilizer of <span class="math notranslate nohighlight">\(\alpha\)</span> is the group <span class="math notranslate nohighlight">\(G_\alpha =
\{g \in G | g(\alpha) = \alpha\}\)</span>.
For a proof of correctness, see [1], p.79.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="n">DihedralGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">DihedralGroup</span><span class="p">(</span><span class="mi">6</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">stabilizer</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
<span class="go">PermutationGroup([</span>
<span class="go">    (5)(0 4)(1 3)])</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.orbit" title="sympy.combinatorics.perm_groups.PermutationGroup.orbit"><code class="xref py py-obj docutils literal notranslate"><span class="pre">orbit</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.strong_gens">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">strong_gens</span></span><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.strong_gens" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a strong generating set from the Schreier-Sims algorithm.</p>
<p class="rubric">Explanation</p>
<p>A generating set <span class="math notranslate nohighlight">\(S = \{g_1, g_2, ..., g_t\}\)</span> for a permutation group
<span class="math notranslate nohighlight">\(G\)</span> is a strong generating set relative to the sequence of points
(referred to as a “base”) <span class="math notranslate nohighlight">\((b_1, b_2, ..., b_k)\)</span> if, for
<span class="math notranslate nohighlight">\(1 \leq i \leq k\)</span> we have that the intersection of the pointwise
stabilizer <span class="math notranslate nohighlight">\(G^{(i+1)} := G_{b_1, b_2, ..., b_i}\)</span> with <span class="math notranslate nohighlight">\(S\)</span> generates
the pointwise stabilizer <span class="math notranslate nohighlight">\(G^{(i+1)}\)</span>. The concepts of a base and
strong generating set and their applications are discussed in depth
in [1], pp. 87-89 and [2], pp. 55-57.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="n">DihedralGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">D</span> <span class="o">=</span> <span class="n">DihedralGroup</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">D</span><span class="o">.</span><span class="n">strong_gens</span>
<span class="go">[(0 1 2 3), (0 3)(1 2), (1 3)]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">D</span><span class="o">.</span><span class="n">base</span>
<span class="go">[0, 1]</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.base" title="sympy.combinatorics.perm_groups.PermutationGroup.base"><code class="xref py py-obj docutils literal notranslate"><span class="pre">base</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.basic_transversals" title="sympy.combinatorics.perm_groups.PermutationGroup.basic_transversals"><code class="xref py py-obj docutils literal notranslate"><span class="pre">basic_transversals</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.basic_orbits" title="sympy.combinatorics.perm_groups.PermutationGroup.basic_orbits"><code class="xref py py-obj docutils literal notranslate"><span class="pre">basic_orbits</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.basic_stabilizers" title="sympy.combinatorics.perm_groups.PermutationGroup.basic_stabilizers"><code class="xref py py-obj docutils literal notranslate"><span class="pre">basic_stabilizers</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.strong_presentation">
<span class="sig-name descname"><span class="pre">strong_presentation</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L4709-L4829"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.strong_presentation" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a strong finite presentation of <span class="math notranslate nohighlight">\(G\)</span>. The generators
of the returned group are in the same order as the strong
generators of <span class="math notranslate nohighlight">\(G\)</span>.</p>
<p>The algorithm is based on Sims’ Verify algorithm described
in [1], Chapter 6.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="n">DihedralGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">P</span> <span class="o">=</span> <span class="n">DihedralGroup</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">P</span><span class="o">.</span><span class="n">strong_presentation</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">P</span><span class="o">.</span><span class="n">order</span><span class="p">()</span> <span class="o">==</span> <span class="n">G</span><span class="o">.</span><span class="n">order</span><span class="p">()</span>
<span class="go">True</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.presentation" title="sympy.combinatorics.perm_groups.PermutationGroup.presentation"><code class="xref py py-obj docutils literal notranslate"><span class="pre">presentation</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup._verify" title="sympy.combinatorics.perm_groups.PermutationGroup._verify"><code class="xref py py-obj docutils literal notranslate"><span class="pre">_verify</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.subgroup">
<span class="sig-name descname"><span class="pre">subgroup</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">gens</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L3930-L3940"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.subgroup" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the subgroup generated by <span class="math notranslate nohighlight">\(gens\)</span> which is a list of
elements of the group</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.subgroup_search">
<span class="sig-name descname"><span class="pre">subgroup_search</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">prop</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">base</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">strong_gens</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">tests</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">init_subgroup</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L3942-L4193"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.subgroup_search" title="Permalink to this definition">¶</a></dt>
<dd><p>Find the subgroup of all elements satisfying the property <code class="docutils literal notranslate"><span class="pre">prop</span></code>.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>prop</strong></p>
<blockquote>
<div><p>The property to be used. Has to be callable on group elements
and always return <code class="docutils literal notranslate"><span class="pre">True</span></code> or <code class="docutils literal notranslate"><span class="pre">False</span></code>. It is assumed that
all group elements satisfying <code class="docutils literal notranslate"><span class="pre">prop</span></code> indeed form a subgroup.</p>
</div></blockquote>
<p><strong>base</strong></p>
<blockquote>
<div><p>A base for the supergroup.</p>
</div></blockquote>
<p><strong>strong_gens</strong></p>
<blockquote>
<div><p>A strong generating set for the supergroup.</p>
</div></blockquote>
<p><strong>tests</strong></p>
<blockquote>
<div><p>A list of callables of length equal to the length of <code class="docutils literal notranslate"><span class="pre">base</span></code>.
These are used to rule out group elements by partial base images,
so that <code class="docutils literal notranslate"><span class="pre">tests[l](g)</span></code> returns False if the element <code class="docutils literal notranslate"><span class="pre">g</span></code> is known
not to satisfy prop base on where g sends the first <code class="docutils literal notranslate"><span class="pre">l</span> <span class="pre">+</span> <span class="pre">1</span></code> base
points.</p>
</div></blockquote>
<p><strong>init_subgroup</strong></p>
<blockquote>
<div><p>if a subgroup of the sought group is
known in advance, it can be passed to the function as this
parameter.</p>
</div></blockquote>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>res</p>
<blockquote>
<div><p>The subgroup of all elements satisfying <code class="docutils literal notranslate"><span class="pre">prop</span></code>. The generating
set for this group is guaranteed to be a strong generating set
relative to the base <code class="docutils literal notranslate"><span class="pre">base</span></code>.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Explanation</p>
<p>This is done by a depth-first search with respect to base images that
uses several tests to prune the search tree.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="p">(</span><span class="n">SymmetricGroup</span><span class="p">,</span>
<span class="gp">... </span><span class="n">AlternatingGroup</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.testutil</span> <span class="kn">import</span> <span class="n">_verify_bsgs</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S</span> <span class="o">=</span> <span class="n">SymmetricGroup</span><span class="p">(</span><span class="mi">7</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">prop_even</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="n">x</span><span class="o">.</span><span class="n">is_even</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">base</span><span class="p">,</span> <span class="n">strong_gens</span> <span class="o">=</span> <span class="n">S</span><span class="o">.</span><span class="n">schreier_sims_incremental</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">S</span><span class="o">.</span><span class="n">subgroup_search</span><span class="p">(</span><span class="n">prop_even</span><span class="p">,</span> <span class="n">base</span><span class="o">=</span><span class="n">base</span><span class="p">,</span> <span class="n">strong_gens</span><span class="o">=</span><span class="n">strong_gens</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">is_subgroup</span><span class="p">(</span><span class="n">AlternatingGroup</span><span class="p">(</span><span class="mi">7</span><span class="p">))</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">_verify_bsgs</span><span class="p">(</span><span class="n">G</span><span class="p">,</span> <span class="n">base</span><span class="p">,</span> <span class="n">G</span><span class="o">.</span><span class="n">generators</span><span class="p">)</span>
<span class="go">True</span>
</pre></div>
</div>
<p class="rubric">Notes</p>
<p>This function is extremely lengthy and complicated and will require
some careful attention. The implementation is described in
[1], pp. 114-117, and the comments for the code here follow the lines
of the pseudocode in the book for clarity.</p>
<p>The complexity is exponential in general, since the search process by
itself visits all members of the supergroup. However, there are a lot
of tests which are used to prune the search tree, and users can define
their own tests via the <code class="docutils literal notranslate"><span class="pre">tests</span></code> parameter, so in practice, and for
some computations, it’s not terrible.</p>
<p>A crucial part in the procedure is the frequent base change performed
(this is line 11 in the pseudocode) in order to obtain a new basic
stabilizer. The book mentiones that this can be done by using
<code class="docutils literal notranslate"><span class="pre">.baseswap(...)</span></code>, however the current implementation uses a more
straightforward way to find the next basic stabilizer - calling the
function <code class="docutils literal notranslate"><span class="pre">.stabilizer(...)</span></code> on the previous basic stabilizer.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.sylow_subgroup">
<span class="sig-name descname"><span class="pre">sylow_subgroup</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/combinatorics/perm_groups.py#L4391-L4525"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.sylow_subgroup" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a p-Sylow subgroup of the group.</p>
<p>The algorithm is described in [1], Chapter 4, Section 7</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="n">DihedralGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="n">SymmetricGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.named_groups</span> <span class="kn">import</span> <span class="n">AlternatingGroup</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">D</span> <span class="o">=</span> <span class="n">DihedralGroup</span><span class="p">(</span><span class="mi">6</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S</span> <span class="o">=</span> <span class="n">D</span><span class="o">.</span><span class="n">sylow_subgroup</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S</span><span class="o">.</span><span class="n">order</span><span class="p">()</span>
<span class="go">4</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">SymmetricGroup</span><span class="p">(</span><span class="mi">6</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S</span> <span class="o">=</span> <span class="n">G</span><span class="o">.</span><span class="n">sylow_subgroup</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S</span><span class="o">.</span><span class="n">order</span><span class="p">()</span>
<span class="go">5</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">G1</span> <span class="o">=</span> <span class="n">AlternatingGroup</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G2</span> <span class="o">=</span> <span class="n">AlternatingGroup</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G3</span> <span class="o">=</span> <span class="n">AlternatingGroup</span><span class="p">(</span><span class="mi">9</span><span class="p">)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">S1</span> <span class="o">=</span> <span class="n">G1</span><span class="o">.</span><span class="n">sylow_subgroup</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S2</span> <span class="o">=</span> <span class="n">G2</span><span class="o">.</span><span class="n">sylow_subgroup</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S3</span> <span class="o">=</span> <span class="n">G3</span><span class="o">.</span><span class="n">sylow_subgroup</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">len1</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">S1</span><span class="o">.</span><span class="n">lower_central_series</span><span class="p">())</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">len2</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">S2</span><span class="o">.</span><span class="n">lower_central_series</span><span class="p">())</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">len3</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">S3</span><span class="o">.</span><span class="n">lower_central_series</span><span class="p">())</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">len1</span> <span class="o">==</span> <span class="n">len2</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">len1</span> <span class="o">&lt;</span> <span class="n">len3</span>
<span class="go">True</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.combinatorics.perm_groups.PermutationGroup.transitivity_degree">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">transitivity_degree</span></span><a class="headerlink" href="#sympy.combinatorics.perm_groups.PermutationGroup.transitivity_degree" title="Permalink to this definition">¶</a></dt>
<dd><p>Compute the degree of transitivity of the group.</p>
<p class="rubric">Explanation</p>
<p>A permutation group <span class="math notranslate nohighlight">\(G\)</span> acting on <span class="math notranslate nohighlight">\(\Omega = \{0, 1, ..., n-1\}\)</span> is
<code class="docutils literal notranslate"><span class="pre">k</span></code>-fold transitive, if, for any k points
<span class="math notranslate nohighlight">\((a_1, a_2, ..., a_k)\in\Omega\)</span> and any k points
<span class="math notranslate nohighlight">\((b_1, b_2, ..., b_k)\in\Omega\)</span> there exists <span class="math notranslate nohighlight">\(g\in G\)</span> such that
<span class="math notranslate nohighlight">\(g(a_1)=b_1, g(a_2)=b_2, ..., g(a_k)=b_k\)</span>
The degree of transitivity of <span class="math notranslate nohighlight">\(G\)</span> is the maximum <code class="docutils literal notranslate"><span class="pre">k</span></code> such that
<span class="math notranslate nohighlight">\(G\)</span> is <code class="docutils literal notranslate"><span class="pre">k</span></code>-fold transitive. ([8])</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.perm_groups</span> <span class="kn">import</span> <span class="n">PermutationGroup</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.combinatorics.permutations</span> <span class="kn">import</span> <span class="n">Permutation</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">Permutation</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span> <span class="o">=</span> <span class="n">PermutationGroup</span><span class="p">([</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">G</span><span class="o">.</span><span class="n">transitivity_degree</span>
<span class="go">3</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.is_transitive" title="sympy.combinatorics.perm_groups.PermutationGroup.is_transitive"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_transitive</span></code></a>, <a class="reference internal" href="#sympy.combinatorics.perm_groups.PermutationGroup.orbit" title="sympy.combinatorics.perm_groups.PermutationGroup.orbit"><code class="xref py py-obj docutils literal notranslate"><span class="pre">orbit</span></code></a></p>
</div>
</dd></dl>

</dd></dl>

</section>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="../../index.html">
              <img class="logo" src="../../_static/sympylogo.png" alt="Logo"/>
            </a></p>
  <h4>Previous topic</h4>
  <p class="topless"><a href="permutations.html"
                        title="previous chapter">Permutations</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="polyhedron.html"
                        title="next chapter">Polyhedron</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../../_sources/modules/combinatorics/perm_groups.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="https://docs.sympy.org/latest/search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="polyhedron.html" title="Polyhedron"
             >next</a> |</li>
        <li class="right" >
          <a href="permutations.html" title="Permutations"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">SymPy 1.9 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../index.html" >SymPy Modules Reference</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="index.html" >Combinatorics</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="#">Permutation Groups</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2021 SymPy Development Team.
      Last updated on Sep 30, 2021.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.1.2.
    </div>
  </body>

<!-- Mirrored from docs.sympy.org/latest/modules/combinatorics/perm_groups.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 15 Jan 2022 03:26:06 GMT -->
</html>